operator overloading + - / * = etc...

Roman Neuhauser neuhauser+python-list#python.org at sigpipe.cz
Tue Oct 10 13:49:45 CEST 2006


# steve at holdenweb.com / 2006-10-08 11:44:18 +0100:
> That's because assignment isn't an operator - that's why (for example)
> 
>      print x = 33
> 
> would be a syntax error. This is a deliberate design decision about 
> which, history shows, there is little use complaining.

    Just to clarify: not that there's little complaining about
    assignment not being an expression, it's useless to complain because
    all previous complaints have been shot down on the basis of claims
    of reduced safety and readability. People who complain often fail to
    see how
    
    x = foo()
    while x:
        process(x)
        x = foo()

    is safer than

    while x = foo():
        process(x)

    (duplication hampers code safety) or how some other features present
    in the language, e. g.  comprehensions, could make it past the
    readability check.

    Everybody has an opinion; those who put the most work in the project
    get to decide what the software looks like.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991



More information about the Python-list mailing list