On Thu, 21 Feb 2008 16:23:23 -0800, Jeff Schwab wrote: > Steve Holden wrote: [...] >>>> if m = pat.match(some_string): >>>> do_something(m) >>> >>> Yep, this is exactly what I am (was) trying to do. Oh well.... Any >>> clever ideas on this front? >>> >> The syntax is the way it is precisely to discourage that kind of clever >> idea. Of course, people nevertheless manage to work around the >> restriction to try and make their Python read like some other language >> they are more familiar with, and most of the time they get away with >> it. >> >> The fat remains that in programming there *is* such a thing as being >> too clever, and Python's syntax deliberately discourages that. > > This isn't "clever." It's what most of us were taught, from the > beginning, was best practice. In some languages (including C and C++) > the above is extremely common and perfectly acceptable.
Speak for yourself. *I* was never taught to abuse assignment by making it an expression, and in the languages I have used, it isn't. I'm sorry that your programming ability has been permanently harmed by learning C at too early an age, but please don't imagine the rest of us suffer from this disability. *wink* -- Steven -- http://mail.python.org/mailman/listinfo/python-list