any interest in type-scoped static constants?

Alexander Semenov sav at ulmen.mv.ru
Sun Mar 11 16:47:49 EST 2001


"Paul Miller" <paul at fxtech.com> wrote in message
news:3AAB9578.4C8754E4 at fxtech.com...
> If I write an extension type that mirrors the functionality of a C++
> class, and the C++ has static constants within its scope, I can do this
> in C++:
>
> Point p = Point::ZERO;
>
> Where ZERO is defined as:
>
> class Point
> {
> static Point ZERO = Point(0, 0);
> };
>
> If I create an extension type for Point, I can't do this:
>
> p = Point.ZERO

In Python:

class Point:
    def __init(self, x, y): pass

Point.ZERO = Point(0,0)

Then you can write p = Point.ZERO.
It's even simpler and clearer then C++

WBR,
Alexander Semenov.






More information about the Python-list mailing list