[Python-bugs-list] [ python-Bugs-660022 ] parameters for int(), str(), etc.

SourceForge.net noreply@sourceforge.net
Wed, 11 Jun 2003 01:16:53 -0700


Bugs item #660022, was opened at 2002-12-30 10:47
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=660022&group_id=5470

Category: Documentation
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Aahz (aahz)
Assigned to: Raymond Hettinger (rhettinger)
Summary: parameters for int(), str(), etc.

Initial Comment:
The built-in functions int(), str(), float(), long() are documented as
requiring a parameter, but the type/class unification has changed them
so that they return a false object without a parameter:

>>> int()
0
>>> str()
''
>>> float()
0.0
>>> long()
0L


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-06-11 03:16

Message:
Logged In: YES 
user_id=80475

Fixed.  See Doc/lib/libfuncs.tex 1.135


----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2003-01-01 23:31

Message:
Logged In: YES 
user_id=80475

There are a lot of these:
[(0, False), (0.0, False), (0j, False), (0L, False), ((), False), 
([], False), ({}, False), ('', False), (u'', False)]

See attached doc patch. Also, consider adding a 
\versionchanged tag and changing the doc strings.

BTW, I think it is more complete and accurate to say that 
the contructors return an empty container or zero than it 
is to just say that bool(constructor()) is False.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=660022&group_id=5470