allow line break at operators

rantingrick rantingrick at gmail.com
Mon Aug 15 17:21:24 EDT 2011


On Aug 15, 2:31 am, Terry Reedy <tjre... at udel.edu> wrote:
> On 8/15/2011 12:28 AM, Seebs wrote:
>
> To repeat again: you are free to put in explicit dedent markers that
> will let you re-indent code should all indents be removed.


As Terry has been trying to say for a while now, use the following
methods to quell your eye pain.

------------------------------------------------------------
 Use pass statement:
------------------------------------------------------------

if foo:
    if bar:
        baz
    else:
        pass
else:
    quux

------------------------------------------------------------
 Use comments:
------------------------------------------------------------

if foo:
    if bar:
        baz
    #else bar (or endif or whatever you like)
else:
    quux

------------------------------------------------------------
 Use road signs: :-)
------------------------------------------------------------

# [Warning: Curves Ahead: Eyeball Parse limit 35 WPM!]
if foo: # [Exit 266: "foo"] -->
    # [Right Curve Ahead: slow eyeball parsing to 15 WPM!]
    if bar:
        baz
    else:
        pass # <-- [Warning: Do not litter!]
else: # [Exit 267: "Not Foo"] -->
    # [Right Curve Ahead: slow eyeball parsing to 15 WPM!]
    quux
...
# [Eyeball Parse limit 55 WPM!]
...
# [PSA: Friends don't let friends write asinine code]
...
# [Next Rest Stop: NEVER!]

------------------------------------------------------------

Now you have the nice triangular shape that your eyes have been
trained to recognize! I would suggest to use comments whenever
possible. Of course there will be times when you cannot use a comment
and must use an else clause.

Now you have nothing to complain about :).



More information about the Python-list mailing list