Re: Dynamic classes

Greg Ewing via Python-list <[email protected]>
Newsgroups gmane.comp.python.general
Message-ID <[email protected]>
On 20/05/25 4:33 am, Stefan Ram wrote:
>    So, the reason you're getting that
>    TypeError is your __init__ function isn't actually hooked up
>    right when you build your class with "type". You got to set up
>    your init before you call "type", and then drop it into the
>    class dictionary as a /function/ (not as a string).

That's what he did, or at least that's what he tried to do.
It turns out the misplaced quote was the entire problem -- by a
fluke, it didn't result in a syntax error, and ended up putting
the __init__ function into the dict under the name
'Flag3: 4, __init__'.

-- 
Greg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.