Re: Dynamic classes

Greg Ewing <[email protected]> Tue, 20 May 2025 12:29:09 +1200
Newsgroups comp.lang.python
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