[Python-bugs-list] [ python-Bugs-699312 ] builtin type inconsistency
SourceForge.net
noreply@sourceforge.net
Sat, 19 Apr 2003 14:09:18 -0700
Bugs item #699312, was opened at 2003-03-07 11:59
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=699312&group_id=5470
Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Alex Martelli (aleax)
Assigned to: Nobody/Anonymous (nobody)
Summary: builtin type inconsistency
Initial Comment:
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.
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2003-04-19 23:09
Message:
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
----------------------------------------------------------------------
Comment By: Alex Martelli (aleax)
Date: 2003-04-19 20:45
Message:
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...
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2003-03-15 14:45
Message:
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.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=699312&group_id=5470