python3: 'where' keyword
aleaxit at yahoo.com
Sun Jan 9 12:41:47 CET 2005
Nick Coghlan <ncoghlan at iinet.net.au> wrote:
> Alex Martelli wrote:
> > I wonder if 'with', which GvR is already on record as wanting to
> > introduce in 3.0, might not be overloaded instead.
> Perhaps we could steal 'using' from the rejected decorator syntax.
> x = [f(x) for x in seq] using:
> def f(x):
> return x * x
If 'with' is going to become a keyword anyway, I suspect that many,
Guido included, would see giving 'with' two distinct syntax roles as a
lower 'price' than introducing yet another keyword, as long of course as
no ambiguity results. 'import', for example, is happily reused for both
'import foo' and 'from foo import bar'.
In terms of readability I see nothing in it, either way, between 'with'
and 'using' (and 'where', were it not for the wildly different semantics
it has in SQL) -- e.g. your example seems to read just fine with any of
If the use Guido intends for 'with' is something like:
.x = .y
aname.x = aname.y
then there would be no ambiguity between this use of with as a leading
keyword in the new statement, always followed by a name; and its use in
the "with clause", where it always comes after an expression and is
immediately followed by a colon. I mean, no ambiguity for either the
parser or a human reader, I believe.
Once the AST-branch is folded back into the CVS head, playing around
with syntax should be much easier than today...
More information about the Python-list