if-else statement

Aaron Brady castironpi at gmail.com
Sun Jan 11 08:55:22 EST 2009


On Jan 10, 2:28 pm, bearophileH... at lycos.com wrote:
> Scott David Daniels:
>
> >       if checking:
> >           my_var = 'string'
> >       else:
> >           my_var = 'other string'
>
> > remember, vertical space only kills trees if printed.
>
> I value clarity a lot. But this is more DRY, sometimes it's almost
> equally clear, and you reduce vertical space, packing more code in the
> same space, this allows you to see more logic, allowing you to have a
> higher level view of the code, so allows you to understand the code
> better:
>
> my_var = 'string' if checking else 'other string'
>
> So I think that sometimes it's useful.
>
> Bye,
> bearophile

It would be a good tool that allows you to see logic-- extra points
for dynamic!

A quick Google for 'python flow chart' turns up 'Visustin' (commercial
+ demo), 'Flowchart Python', & others.  http://www.google.com/search?q=python+flow+chart
.  The "bird's eye view" in Visustin is pretty cool.

Control-flow-only could be a lot simpler, just filtering statements
with 'if/while/for', and try-except, not even in diagram.  It's on the
way for the open source IDE, right?



More information about the Python-list mailing list