Define Constants

codecraig codecraig at gmail.com
Wed Apr 20 17:05:33 EDT 2005


Hi,
  I have a question about how to define constants.

  My directory structure looks like...

C:\
    --> abc.py
    --> utils
        --> __init__.py
        --> CustomThing.py

  Ok, CustomThing looks like...

TOP = 0
LEFT = 1

class CustomThing:
    def __init__(self):
        self.foo = "foo"



  so, from abc.py I have

from utils.CustomThing import CustomThing

print CustomThing.TOP

but i get an error: AttributeError: class 'CustomThing' has no
attribute 'TOP'


How can I access those??

Thanks.




More information about the Python-list mailing list