[Python-Dev] Extended Function syntax
Bernhard Herzog
bh@intevation.de
03 Feb 2003 17:31:34 +0100
Alex Martelli <aleax@aleax.it> writes:
> M own O is drastically different: I'm quite happy to have no assignment
> in expressions -- I think "with" SHOULD be able to bind a variable,
> though, much like, say, "for" should (and does), because MOST of
> the time you DO want that variable available in the body.
I for one am not so sure about the most. It's not needed for a lock for
instance. I do realise that it will often be convenient, though, such as
in the file example.
OTOH, an assignment would often be convenient in a while loop or if
statement as well and while people often ask for assignments in if and
while so far Python has not been changed to allow it.
I think that if "with" is added to Python it should not allow assignment
at first. Then after people have been using it for some time we can look
at the actual use cases and if it turns out that the need for an
assignment is much greater in "with" than in "while" et al. it can
easily be added without any backwards incompatibility.
We should also keep in mind that if Python had a way to do assignment in
expressions there wouldn't be any need to make "with" special in this
regard.
Bernhard
--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://www.mapit.de/