mutability, namimg, ...

Fredrik Lundh fredrik at pythonware.com
Wed May 9 02:40:44 EDT 2001


Mark Jackson wrote:
> What I *do* find counterintuitive is Python's use of "else" in "while",
> "for", and "try" constructs.  But that's because it seems backwards
> relative to its meaning in Python's "if"

backwards?

    if test:
        # run if true
    else:
        # run if false

    while test:
        # run if true
    else:
        # run if false

    for var in sequence:
        # where "for-in" tests if the next element can
        # be assigned from the sequence
        # run if true
    else:
        # run if false

can it be more consistent?

Cheers /F





More information about the Python-list mailing list