For review: PEP 308 - If-then-else expression

Matthew Dixon Cowles matt at
Sun Feb 9 21:06:37 CET 2003

On Sun, 9 Feb 2003 15:00:01 -0200, Carlos Ribeiro
<cribeiro at> 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?

As Alex points out, execution order does match reading order in this
case. If it's un-Pythonic it must be for another reason. And I'll
admit that I found it weird as heck the first time I saw it. But I
think that the logic for doing it that way is compelling: Lots of
things can be indexed. Lists, tuples, strings, and many user classes
can be indexed. If join() were a method of the thing being indexed, it
would have to be implemented in many places. As a method of the
separator, it can be implemented only once.


More information about the Python-list mailing list