K
Kay Schluehr
/ You can define a class variable Pos with the class Pos as its value
/>>/
/>>/ class PeriodicGrid :
/>>/ class Pos:
/>>/ pass
/>>/ Pos = Pos
/>>/
/>>/ >>> grid = PeriodicGrid()
/>>/ >>> grid.Pos()
*sigh*
It's a matter of good i.e. bad taste. Ususally I prefer constructs like this:
class Pos:
class Pos:
def __init__(self):
self.__dict__ = Pos.__dict__
Pos = staticmethod(Pos)
and spread them all over my code thinking they are genuine Pythonic
with the emphasis of the original meaning of the word and for sake of the
great ancestors. I call them "strange idiom" idioms and they are
made for torturing mankind. If a believing christ would ask me why i do so
the answer would be: calling the animal and accelerating judgement day.
Bye and have a nice Sunday afternoon
Kay
/>>/
/>>/ class PeriodicGrid :
/>>/ class Pos:
/>>/ pass
/>>/ Pos = Pos
/>>/
/>>/ >>> grid = PeriodicGrid()
/>>/ >>> grid.Pos()
/>>/ said:You can, but that 'Pos = Pos' statement in this code is just as
redundant and useless as it appears. In every aspect, the behavior will
be exactly identical if you remove that assignment.
Alex
*sigh*
It's a matter of good i.e. bad taste. Ususally I prefer constructs like this:
class Pos:
class Pos:
def __init__(self):
self.__dict__ = Pos.__dict__
Pos = staticmethod(Pos)
and spread them all over my code thinking they are genuine Pythonic
with the emphasis of the original meaning of the word and for sake of the
great ancestors. I call them "strange idiom" idioms and they are
made for torturing mankind. If a believing christ would ask me why i do so
the answer would be: calling the animal and accelerating judgement day.
Bye and have a nice Sunday afternoon
Kay