26-08-2009 o 09:03:27 Ulrich Eckhardt <eckha...@satorlaser.com> wrote:
Jean-Michel Pichavant wrote:
class Color:
def __init__(self, r, g,b):
pass
BLACK = Color(0,0,0)
It make sens from a design point of view to put BLACK in the Color
namespace. But I don't think it's possible with python.
class Color:
...
setattrib(Color, "BLACK", Color(0,0,0))
Or simpler:
class Color:
...
Color.BLACK = Color(...)
Then
(Color.BLACK is Color.BLACK.BLACK.BLACK.BLACK) == True
:-)
*j
PS. Obviously, that's nothing special (there is no problem with
creating such "recursive" references in Python).
--
Jan Kaliszewski (zuo) <z...@chopin.edu.pl>
--
http://mail.python.org/mailman/listinfo/python-list