'with' statement in python ?

Maciej Pilichowski macias at bp.com.pl
Tue Jun 26 07:49:50 EDT 2001


On Mon, 25 Jun 2001 21:30:36 -0300, Carlos Ribeiro
<cribeiro at mail.inet.com.br> wrote:

I have just started learning Python yesterday but...

>def with_is_broken(a):
>   with a:
>     print x
>
>The snippet above assume that "a" must have a member attribute called "x". 

Nope. As you referred to Pascal -- if "a" has a member "x" it is read
as "a.x", if not it is standalone "x". 

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