any interest in type-scoped static constants?

Paul Miller paul at
Sun Mar 11 19:55:10 CET 2001

> Hmmmm....  The problem is that in Python, you've got a recursive
> structure definition -- is that exact syntax really legal in C++?  In

It's legal - what it's doing is defining a static instance of the class
that is INSIDE the class's scope. It's just a scoping thing.

> Python itself, the way I'd do this is to create a module Point that
> contains the Point class, and following the class definition create the
> ZERO object.  Then you refer to it as Point.ZERO and create new points
> with Point.Point().

You are right that I could do this. However, I'm talking about extension
types. If I am embedding Python in an app, I may be providing several
extension types, that provide access to my internal C++ classes.
However, I do not want to make a module for each type.

I realize I could have a "" that is automatically imported,
or I could put my constants in my module dictionary, but this is not
object-oriented. I would like to SCOPE my constants by the class/type
they relate to.

What I want is a dictionary that is associated with a TYPE, that
contains constant attributes for the TYPE.

More information about the Python-list mailing list