nested classes

Stefan Seefeld seefeld at sympatico.ca
Mon Jun 18 18:32:58 CEST 2001


hi there,

I'd like to provide a hierarchy of config data by means of
nested classes and static variables, such as:

class A:
    prefix='usr/local'
    class B:
	datadir = A.prefix + '/share'
...

however, I get a NameError: name 'A' is not defined

What am I doing wrong ? The above is possibly a bit driven
by my C++ programming style. What is the python way of doing
this ?

Thanks,
		Stefan



More information about the Python-list mailing list