[Python-ideas] int('0x3241fca1')

Ram Rachum ram.rachum at gmail.com
Thu Feb 6 13:51:08 CET 2014


On Thu, Feb 6, 2014 at 2:47 PM, Andrew Barnert <abarnert at yahoo.com> wrote:

> On Feb 6, 2014, at 4:44, Ram Rachum <ram.rachum at gmail.com> wrote:
>
> Ah, you're talking about non-programmers. I can't imagine though a
> non-programmer seriously complaining that "0x0" is a number while "0z"
> isn't.
>
>
> Can you please read the whole sentence before replying to it? I
> specifically said "Would a newbie--or a non-programmer using a
> program--understand..."
>
> And you can't imagine a non-programmer complaining that "0123" is either
> not a number, or the number 83?
>

You're right. I suggest int would just throw away the leading zeroes. In
Python 3.x there's no meaning to them without 0o or 0x or 0b anyway, right?


>
> On Thu, Feb 6, 2014 at 2:41 PM, Andrew Barnert <abarnert at yahoo.com> wrote:
>
>> On Feb 6, 2014, at 4:35, Ram Rachum <ram.rachum at gmail.com> wrote:
>>
>> On Thu, Feb 6, 2014 at 2:31 PM, Andrew Barnert <abarnert at yahoo.com>wrote:
>>
>>> On Feb 6, 2014, at 4:19, Ram Rachum <ram.rachum at gmail.com> wrote:
>>>
>>> I don't understand... The newbie will pass '0x13412' to the int
>>> constructor by mistake and be surprised when it's parsed as hex? Doesn't
>>> make sense does it?
>>>
>>>
>>> Would a newbie--or a non-programmer using a program--understand why,
>>> say, "0X0" counts as a valid number but "0Z" doesn't?
>>>
>>
>> Since they're likely to get the same confusion while feeding literals to
>> the Python shell, I think this is acceptable.
>>
>>
>> You think it's acceptable that a non-programmer should have to understand
>> the python shell to use any program written in Python?
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140206/a4019438/attachment.html>


More information about the Python-ideas mailing list