Comment on draft PEP for deprecating six builtins

Duncan Booth duncan at NOSPAMrcp.co.uk
Tue Apr 30 08:37:47 EDT 2002


Roy Smith <roy at panix.com> wrote in
news:roy-E96293.07453430042002 at news1.panix.com: 

> Duncan Booth <duncan at NOSPAMrcp.co.uk> 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).
> 
> What about "(42).chr"?  Wouldn't that work?  Seems a lot more natural
> than putting a space in there (which I didn't even realize was legal,
> and looks horrible to me).
> 
There are lots of things that would work. '*' is probably the cleanest.
It is just that methods on int have this slight wart. As is clear from the 
followups to my posting, most people find it surprising that the parser 
works that way and (IMHO) it is good to avoid surprising people.

[I'm not sure that came out quite right: I'm sure lots of the people on 
this newsgroup can be surprising, and I don't feel I have to avoid you.]

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list