Yep, that's what I meant :)On Thu, Feb 6, 2014 at 2:28 PM, spir <denis.spir@gmail.com> wrote:
Do you mean int(numeral), where numeral is a *variable* string, with a python base prefix? (Else, just type in the constant 0x3414fa ;-) If yes, then I find it a good idea. When int() is used to decode variable numerals, it could/should/would decode all correct python numeral notations.On 02/06/2014 11:24 AM, Ram Rachum wrote:
What do you think about letting the `int` constructor automatically
understand the number type without specifying base if given a prefix, so
int('0x3414fa') would immediately work without specifying a base of 16?
Note that int() also does not decode 'e' postfixes:
Python 3.3.2+ (default, Oct 9 2013, 14:50:09)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
12300int(123e2)
Traceback (most recent call last):int("123e2")
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '123e2'
But float() does:
-12300.0float(-1.23e4)
-12300.0float("-1.23e4")
!
After all, it's just a question of practical notational conventions (we don't use "hundred and twenty-three" or "CXXIII" or "v^^^^^v^^"). Python's own decoding builtins should be consistent with its own choice of notations.
d
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/
--
--- You received this message because you are subscribed to a topic in the Google Groups "python-ideas" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python-ideas/RKQviWz9BYk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python-ideas+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/