Python syntax wart

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Sun Sep 9 01:16:05 EDT 2007


The one thing I don't like about Python syntax is using backslashes to
continue lines. Yes, you can avoid them if you can include parentheses
somehow, but this isn't always possible.

Possible:

    if (
            quitting
        and
            len(client["to_write"]) == 0
        and
            len(client["read"]) + client["to_read"] == 0
    ) :
        close_client(client, "shutting down")
    #end if

Not possible:

    for \
        Link \
    in \
        GetEachRecord \
          (
            "links",
            ("from_episode",),
            "to_episode = %s",
            [EpisodeID],
            "order by when_created"
          ) \
    :
        out.write \
          (
                "<P><A HREF=\"%s\">Back to episode %d</A>\n"
            %
                (
                    LinkToMe({"ep" : Link["from_episode"]}),
                    Link["from_episode"]
                )
          )
    #end for
 



More information about the Python-list mailing list