Class Variable Access and Assignment

Steven D'Aprano steve at REMOVETHIScyber.com.au
Fri Nov 4 13:02:05 EST 2005


On Fri, 04 Nov 2005 10:48:54 +0000, Antoon Pardon wrote:

> Please explain why this is illegal.
> 
> x = 1
> def f():
>   x += 1

Because names in function namespaces don't have inheritance.


-- 
Steven.




More information about the Python-list mailing list