Return value of an assignment statement?
Bruno Desthuilliers
bruno.42.desthuilliers at wtf.websiteburo.oops.com
Wed Feb 27 09:35:14 EST 2008
Jeff Schwab a écrit :
(snip)
> This is apparently section 1.9 of the Python Cookbook:
>
> http://www.oreilly.com/catalog/pythoncook2/toc.html
>
> Martelli suggests something similar to the "thigamabob" technique I use
> (he calls it DataHolder). It's really more like the "xmatch" posted by
> Paul Rubin.
>
> Martelli also says, though, that if you need this, you're not thinking
> Pythonically.
I'd personnaly read this as: "for most concrete cases, there's a Python
idiom such that you don't need to set-and-test-at-once" - an example
being given for the concrete case of 'iterating over lines in a file'.
> I don't know what the Pythonic alternative is. The
> iterating-over-pairs approach suggested by Bruno is the only alternative
> I've seen.
I guess it's considered the "pythonic alternative" for the concrete use
case where there's no better idiom !-)
Note that as far as I'm concerned, I don't have much problem with
get-and-set (which I commonly use in most other languages allowing it).
In fact I'd probably prefer an expression-based version of Python (now
would it still be Python is another question...) - but that's not been
so far a string enough reason to switch language...
More information about the Python-list
mailing list