On May 21, 5:50 pm, "inhahe" <[EMAIL PROTECTED]> wrote: > >> One thing I hate from C is the assignment in expressions...Forcing > >> myself to write > >> 0 == Something > >> rather than > >> Something == 0 > > > interesting trick, i've never thought of that/seen it > > although if Python implemented it I think it should default to giving > > warnings when you use = in an expression, that way you don't have to > > worry. > > That introduces complications though, do you want to see a pagefull of > warnings every time you import a module that uses the ='s? > You could specify in your python file that you want to suppress that > warning, but then you'd never know when you used = by accident when you > meant to use ==. > anyway i was thinking you could have a second assignment operator to use > just in expressions, and only allow that. it could be := since some > languages tend to use that. i wouldn't like it as a general assignment > operator but assignment in expressions is a special case. also <- or ->. > C uses -> for functions but I think math/calculators use that for > assignment.
My preference would be ?=. if match ?= my_re1.match(line): # use match elif match ?= my_re2.match(line): # use match elif match ?= my_re3.match(line): # use match -- http://mail.python.org/mailman/listinfo/python-list