'with' statement in python ?

Maciej Pilichowski macias at bp.com.pl
Wed Jun 27 01:57:18 EDT 2001


On Tue, 26 Jun 2001 10:41:31 -0300, Carlos Ribeiro
<cribeiro at mail.inet.com.br> wrote:

>In Python, the compiler/interpreter has no way 
>to tell beforehand if x is a member of a, a local variable, a module level 
>variable, or a global variable. This ambiguity makes the use of with in 
>Python impossible.

Nope. Look below.

>The compiler knows in advance everything about "a". 

What do you mean "in advance"? Compiler knows it at compile time --
what is possible at compile time is possible at runtime, but of course
that would slow down performance /one thing more to search for/.

But! I am not pro "with" -- I think that "with" clause causes code to
read for people much harder. I just wanted to point out that even
interpreting "with" at runtime is still possible to know where the
variable came from.

have a nice day
bye
-- 
Maciej "MACiAS" Pilichowski
http://www.torun.pdi.net/~macias/
                                                      z a k u p i e :
Wyklady Feynmana: tIIcz1; pisma Komputer: 3/86,4/87



More information about the Python-list mailing list