Comment on draft PEP for deprecating six builtins

Alex Martelli aleax at aleax.it
Mon Apr 29 11:59:16 EDT 2002


Roman Neuhauser wrote:

>> The problem with int.chr() is that a lot of people are going to get
>> confused when they find that "42.chr()" doesn't work (although "42
>> .chr()" does).
> 
>     why? letters aren't valid decimal digits, are they?

Decimal digits have nothing to do with it.  The lexer does maximal-munch,
so it snags off "42." as one first valid token (a float), "chr" as a
second one, and so on -- unless you separate the digits from the dot,
e.g. with whitespace, this is more or less inevitable.  And making the
lexer complicated/slower/less predictable to allow "calling methods on
integer literals" without space doesn't appear an attractive trade-off.


Alex




More information about the Python-list mailing list