[Python-ideas] multiple intro statements [was: combine for/with statement]

Jim Jewett jimjjewett at gmail.com
Wed Aug 3 17:44:03 CEST 2011


On Wed, Aug 3, 2011 at 4:11 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> With a slight relaxation of the rules concerning statements
> on a single line, one could write
>
>    for bar in foo: with context: if baz:
>        # stuff
>
> Not that I'd really advocate that, but it might help to
> shut up the people who keep requesting this sort of thing.

hmm... I actually sort of like that ...

    statement: statement: statement:
        suite

is equivalent to

    statement:
        statement:
            statement:
                suite

On its own, it is a pure win to say "This statement really only does
one thing; it is the subordinate statement that has a suite".  That
said, I'm wondering if the colon is used for enough other things that
it would end up causing confusion in practice with slices or
formatting or ...

-jJ



More information about the Python-ideas mailing list