Hi Pythonistas,
I'm stuck in a maze of new style classes and generators. While I love the
concepts, I obviously didn't grok them throughout.
I'm trying to generate a bunch of similar classes, where some are contained
in list attributes of others, e.g.:
class A:
def __init__(self):
Hans-Peter Jansen schrieb:
Hi Pythonistas,
I'm stuck in a maze of new style classes and generators. While I love the
concepts, I obviously didn't grok them throughout.
I'm trying to generate a bunch of similar classes, where some are contained
in list attributes of others, e.g.:
All
In [EMAIL PROTECTED], Hans-Peter Jansen wrote:
class Gen(object):
def records(self, cls):
for i in range(3):
setattr(cls, id, %s%s % (cls.__doc__, i))
yield cls
[…]
class GenA(Gen):
def __init__(self):
self.genB = GenB()
def
Hi Diez,
first, thanks for your comprehensive answer.
Diez B. Roggisch wrote:
Hans-Peter Jansen schrieb:
I'm trying to generate a bunch of similar classes, where some are
contained in list attributes of others, e.g.:
All your code below shows that you don't create classes, but
Marc 'BlackJack' Rintsch wrote:
In [EMAIL PROTECTED], Hans-Peter Jansen wrote:
class Gen(object):
def records(self, cls):
for i in range(3):
setattr(cls, id, %s%s % (cls.__doc__, i))
yield cls
[…]
class GenA(Gen):
def __init__(self):