Comment on draft PEP for deprecating six builtins
Steve Holden
sholden at holdenweb.com
Tue Apr 30 11:22:46 EDT 2002
"Roman Neuhauser" <neuhauser at mail.cz> wrote ...
> > From: Duncan Booth <duncan at NOSPAMrcp.co.uk>
> > Subject: Re: Comment on draft PEP for deprecating six builtins
> > To: python-list at python.org
> > Date: Tue, 30 Apr 2002 12:39:30 +0000 (UTC)
> >
> > 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
>
> IMO that's because join being a string method is just awkward. How
> does this read:
> aList.join(' ')
> After all, you tell the list to give you it's concatenation, using
> the argument as the glue.
>
> > Sometimes though I take advantage of it being a method:
> > joinlines = '\n'.join
> > ...
> > s = joinlines(aList)
>
> This is not a method. You masked it as a global function.
While it might look like a function when you use it, Python seems to be
pretty clear that it isn't, as the following interpreter session shows:
Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> joinlines = '\n'.join
>>> joinlines
<built-in method join of str object at 0x0079A740>
>>>
>
> > 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.
>
> That should be done, of course.
>
There will doubtless be cries about the depracation of the string module
too.
regards
Steve
--
Steve Holden: http://www.holdenweb.com/ ; Python Web Programming:
http://pydish.holdenweb.com/pwp/
More information about the Python-list
mailing list