Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #197485
| From | Greg Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Dynamic classes |
| Date | 2025-05-20 12:29 +1200 |
| Message-ID | <m920mlF41dqU1@mid.individual.net> (permalink) |
| References | <mailman.63.1747669953.3008.python-list@python.org> <dynamic-20250519173131@ram.dialup.fu-berlin.de> |
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
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar
Dynamic classes Jonathan Gossage <jgossage@gmail.com> - 2025-05-19 11:51 -0400
Re: Dynamic classes ram@zedat.fu-berlin.de (Stefan Ram) - 2025-05-19 16:33 +0000
Re: Dynamic classes Greg Ewing <greg.ewing@canterbury.ac.nz> - 2025-05-20 12:29 +1200
csiph-web