On Tue, Mar 25, 2008 at 11:29 AM, Nick Coghlan <ncoghlan at gmail.com> wrote: > The isinstance(value, str) check in Py3k is too restrictive - it needs > to accept bytes instances as well. > Hmm. There's not a lot of consistency here: >>> int(b'1') 1 >>> float(b'1') 1.0 >>> complex(b'1') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: complex() argument must be a string or a number >>> from fractions import Fraction >>> Fraction(b'1') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/dickinsm/python_source/py3k/Lib/fractions.py", line 98, in __new__ numerator = numerator.__index__() AttributeError: 'bytes' object has no attribute '__index__' So int and float accepts bytes, while complex, Decimal and Fraction do not... Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20080325/41694f3f/attachment.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4