Comment on draft PEP for deprecating six builtins

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


Bernhard Herzog <bh at intevation.de> wrote in 
news:6qn0vlbcpk.fsf at abnoba.intevation.de:

>>     Ugh, that looks to me as appropriate as join() being a string
>>     method / module function.
> 
> Exactly. I still think that join as a function makes more sense than as
> a string method and for the same reasons as stated for chr above. Even
> if join is implemented as a string method.

I prefer writing
   str.join(' ', aList)
rather than
   ' '.join(aList)

When the string is a literal I find the former reads much better. YMMV

Sometimes though I take advantage of it being a method:
   joinlines = '\n'.join
   ...
   s = joinlines(aList)

Note that there was a suggestion on the python-dev list to move the 
remaining objects in the string module into the str type and then deprecate 
the string module. So str.hexdigits instead of string.hexdigits etc.

-- 
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