That doesn't really give him a way of using the class variable inside a method.

Ole


2005/9/24, Benji York <[EMAIL PROTECTED]>:
> Carlos wrote:
> > Hi!
> >
> > class A:
> >   X = 2
> >   def F():
> >     print A.X
> >   F()
> >
> > The above fails because the name A is not
> > yet at global scope when the reference A.X
> > is reached. Is there any way to refer to A.X
> > without making explicit use of the name 'A'?
>
> How about this:
>
>  >>> class A:
> ...     X = 2
> ...     print X
> ...
> 2
> --
> Benji York
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to