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.

Author mark.dickinson
Recipients mark.dickinson
Date 2008-03-25.16:21:59
SpamBayes Score 0.3931749
Marked as misclassified No
Message-id <1206462120.7.0.66925954466.issue2483@psf.upfronthosting.co.za>
In-reply-to
Content
In 3.0, the int and float constructors accepts bytes instances as well as 
strings:

>>> int(b'1')
1
>>> float(b'1')
1.0

but the complex constructor doesn't:

>>> complex(b'1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: complex() argument must be a string or a number

I'd suggest that at least one of these three results is a bug,
but I'm not sure which.

From a purity point of view, I think int() and float() shouldn't accept 
bytes.  Is this a case of practicality beats purity?  What are the
pratical reasons to have int() and float() accept bytes?

Once this is resolved, the behaviors of Decimal and Fraction should also 
be considered.
History
Date User Action Args
2008-03-25 16:22:01mark.dickinsonsetspambayes_score: 0.393175 -> 0.3931749
recipients: + mark.dickinson
2008-03-25 16:22:00mark.dickinsonsetspambayes_score: 0.393175 -> 0.393175
messageid: <1206462120.7.0.66925954466.issue2483@psf.upfronthosting.co.za>
2008-03-25 16:22:00mark.dickinsonlinkissue2483 messages
2008-03-25 16:21:59mark.dickinsoncreate