[Python-Dev] Extended Function syntax

Alex Martelli aleax@aleax.it
Mon, 3 Feb 2003 16:21:00 +0100


On Monday 03 February 2003 04:06 pm, Bernhard Herzog wrote:
   ...
> IMO whether with should allow assignment is really completely independed
> of "with". It's just the general design questions of whether to have
> assignment expressions at all.

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.  Not ALL
of the time, just like you sometimes have, say:
    for i in range(5)...
and don't care at all about 'i' in the body, but just need to repeat
something five times.  But I'd rather make some form of binding
MANDATORY in "with", as it is in "for", rather than forbid it.

If the "with blah = bloh:" sugar is not acceptable, I'd settle for
ALMOST anything that has these semantics... ALMOST because
the "with bloh: (blah):" kinds of thingies I've seen proposed on this
thread strike me as weird (having the bound name AFTER the
expression to which it's bound, and no clear indication at all that
a binding is taking place -- maybe it's just the fact that it's so
unusual in Python, but, do we really need those traits...?).


Alex