None & Ellipsis

John Farrell jfarrell at mincom.com
Mon Feb 21 18:36:42 EST 2000


Fredrik Lundh wrote:
> Moshe Zadka <moshez at math.huji.ac.il> wrote
> > Yes. It's called the "Python 3 namespace rule".
> 
> exactly.  and combined with the "local variables
> are detected by static analysis" rule, things get
> really weird.  consider this:
> 
>     def mylongfunction():
>         a = None
>         # ...
>         # a few hundred lines of computation
>         # ...
>         a = 1, 2, 3
>         None, None, b = a
> 
> this results in an exception.  on what line?

Ooh, nasty. My guess is on the a = None line, because None has been
determined to be a local variable by static analysis. Trying to
evaluate the local variable before it is assigned to causes the
error.

of-course-you-can't-run-it-that-would-be-cheating-ly yours

John
-- 
Dr John Farrell - Research Architect - Mincom Limited

I don't suffer from stress.  I am a carrier.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d- s++:+ a C+++ U+ P-- L E--- W++ N+(-) o+ !K w---(+) !O !M !V PS+ PE Y?
PGP t--- !5 !X R(+) tv- b++ DI++ D G e++++ h---- r+++ y++++(*)
------END GEEK CODE BLOCK------
This transmission is for the intended addressee only and is confidential
information. If you have received this transmission in error, please delete
it and notify the sender. The contents of this E-mail are the opinion of the
writer only and are not endorsed by Mincom Limited unless expressly stated
otherwise.




More information about the Python-list mailing list