[Python-ideas] use "as" for block scope support

Bruce Leban bruce at leapyear.org
Mon Jul 25 17:32:21 CEST 2011


On Mon, Jul 25, 2011 at 4:52 AM, 海韵 <lyricconch at gmail.com> wrote:

> ======example 5==================
> K = 1
> A = (K+1 as K, K+2 as Q) K*Q
> assert A == 6 # (1+1) * (1+2)
> assert K==1
> ============example 6===============
> K = 1
> A = (K+1 as K) (K+2 as K) K * K
> assert A == 16  # ((1+1) + 2) * ((1+1) + 2)
> assert K == 1
>

With some headscratching, I can figure out these examples. What I can't
figure out is why you would possibly want to write code like this. It
certainly doesn't enhance readability, and it wouldn't enhance performance
or expressiveness of the language either. If you want to propose
improvements to the language it should do at least one of those things.

-1 as -1

--- Bruce
Follow me: http://www.twitter.com/Vroo http://www.vroospeak.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20110725/2b8f7743/attachment.html>


More information about the Python-ideas mailing list