For review: PEP 308 - If-then-else expression
Carlos Ribeiro
cribeiro at mail.inet.com.br
Mon Feb 10 19:11:31 EST 2003
On Sunday 09 February 2003 17:42, Alex Martelli wrote:
> Carlos Ribeiro wrote:
> > On Saturday 08 February 2003 18:51, Christian Tismer wrote:
> >> b) reading and execution order should match as much as possible.
> >
> > Then I wonder why do people think that the following snippet is pythonic
> > in any (reasonable) way:
> >
> > ','.join(lines)
> >
> > In what direction does it reads?
>
> Left to right:
> From the literal string object ',',
> fetch the attribute named 'join',
> prepare the value of the variable named 'lines' as the argument,
> and execute the attribute (must be a method) with the argument.
Alex,
You're _literally_ right :-). But that doesn't mean that it 'reads right'; my
intention was to say,
'I want my lines joined using commas as delimiters',
not:
'Comma, please join these lines for me.'
btw, this particular discussion is already a few years old, and there's
nothing that can be done about it (and I found myself using it lately, so it
may be the right way to say it after all...)
Carlos Ribeiro
cribeiro at mail.inet.com.br
More information about the Python-list
mailing list