What is the differenace ?

Egbert Bouwman egbert at bork.demon.nl
Thu Nov 16 04:48:44 EST 2000


On Thu, Nov 16, 2000 at 09:24:32AM +0100, Przemys?aw G. Gawro?ski wrote:

> but I can also access the variable i what is the difference between them
> ( i and j ) and why the variable i isn't listed ???

Because i lives in the namespace of class A, and j lives in that of
instance v. If Python cannot find the name in the instance-namespace,
it looks for it in the namespace of the class. Very helpfull, because 
you can keep the common data in the class-space, and the data that
are specific for a given instance, in the instance-space. 
egbert
-- 
Egbert Bouwman - Keizersgracht 197 II - 1016 DS  Amsterdam - 020 6257991
========================================================================




More information about the Python-list mailing list