Python Gotcha's?

Cameron Simpson cs at zip.com.au
Wed Apr 4 19:28:38 EDT 2012


No module level properties:

  >>> @property
  ... def x():
  ...   print 1
  ... 
  >>> x
  <property object at 0x100475f18>

Actually, that doesn't work with classes either, only instances.
Can I refer to the instance of the module/package?

In the interpreter, __package__ is None instead of some unnamed
"module/package".

In general I have a nagging desire that modules were more like classes.
But the details remain nebulous in my mind. The property thing is the
only concrete thing I trip over at present.
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Louis Pasteur's theory of germs is ridiculous fiction.
       --Pierre Pachet, Professor of Physiology at Toulouse, 1872



More information about the Python-list mailing list