This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: builtin type inconsistency
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: aleax, loewis
Priority: normal Keywords:

Created on 2003-03-07 10:59 by aleax, last changed 2022-04-10 16:07 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
bool.patch aleax, 2003-04-19 18:45 patch fixing the problem & testing the fix too
Messages (6)
msg15010 - (view) Author: Alex Martelli (aleax) * (Python committer) Date: 2003-03-07 10:59
many builtin types can be called without arguments, yielding 
the 'false' (zero/empty) instance of their type.  However, 
others can't.  why is int()==0 but calling bool() raises an 
exception rather than returning False?  I consider this 
irregularity a tiny bug.  Arguably slice() should also return 
the same result as slice(None), again for regularity, but this 
is admittedly iffier.
msg15011 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-03-15 13:45
Logged In: YES 
user_id=21627

I agree this is a bug, also I personally would not care
enough to fix it.

Would you like to work on a patch? I guess if your
observation is a principle to be followed, it needs to be
documented, also.
msg15012 - (view) Author: Alex Martelli (aleax) * (Python committer) Date: 2003-04-19 18:45
Logged In: YES 
user_id=60314

submitted a patch for it today, an easy fix, but can't find it here on 
SF as patches -- HMMM!!!.  So I'm uploading it again here just in 
case.  No doc fixes as there is strictly speaking no NEED to 
document this regularity I think, just no reason to make it into an 
IR-regularity just for bool...
msg15013 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-04-19 21:09
Logged In: YES 
user_id=21627

This was committed as 

NEWS 1.736
boolobject.c 1.6
test_types.py 1.49 
test_bool.py 1.8 
msg15014 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-04-19 21:11
Logged In: YES 
user_id=21627

I see now what happened: The patch was 724135, and Guido had
checked it in, and closed it, when tried to find it. SF
should have send you an email both when telling you about
the patch submission, and when Guido was closing it.
msg15015 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-04-19 21:13
Logged In: YES 
user_id=21627

Another remark: It is always a good idea to cross-link
patches and bug reports: When submitting a patch, indicate
what bug it fixes. On the bug patch, add a comment which
patch has been submitted.
History
Date User Action Args
2022-04-10 16:07:27adminsetgithub: 38121
2003-03-07 10:59:08aleaxcreate