[Python-3000] PEP 3101 clarification requests
Eric Smith
eric+python-dev at trueblade.com
Mon Aug 20 21:11:27 CEST 2007
Guido van Rossum wrote:
> On 8/19/07, Eric Smith <eric+python-dev at trueblade.com> wrote:
>> Talin wrote:
>>> Wow, excellent feedback. I've added your email to the list of reminders
>>> for the next round of edits.
>> Here's something else for future edits:
>>
>> 1. When converting a string to an integer, what should the rules be?
>> Should:
>> format("0xd", "d")
>> produce "13", or should it be an error?
>
> I can't see that as anything besides an error. There should be no
> implicit conversions from strings to ints.
OK. I had been planning on implicitly converting between strings, ints,
and floats (in all directions). The PEP doesn't really say.
So the only implicit conversions will be:
int->float
int->string
float->int
float->string
Now that I look at it, % doesn't support string->float or string->int
conversions. Not sure where I got the idea it was needed. I'll remove
it and update my test cases.
Converting to strings doesn't really buy you much, since we have the !s
specifier. But I think it's needed for backward compatibility with %
formatting.
More information about the Python-3000
mailing list