Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #197485
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Greg Ewing <greg.ewing@canterbury.ac.nz> |
| Newsgroups | comp.lang.python |
| Subject | Re: Dynamic classes |
| Date | Tue, 20 May 2025 12:29:09 +1200 |
| Lines | 15 |
| Message-ID | <m920mlF41dqU1@mid.individual.net> (permalink) |
| References | <mailman.63.1747669953.3008.python-list@python.org> <dynamic-20250519173131@ram.dialup.fu-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net bmIhbnwRwuJt0HjajjATNA1gvZOqMbMtaPpUmpxA1fLn927Vsx |
| Cancel-Lock | sha1:3Nx3QWmEHrnhpDJwPvLzlll7AkA= sha256:nK0BCTbv8iXZdGGtw8K9FDVYLT6kzVHXWjSb+baC46I= |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 |
| Content-Language | en-US |
| In-Reply-To | <dynamic-20250519173131@ram.dialup.fu-berlin.de> |
| Xref | csiph.com comp.lang.python:197485 |
Show key headers only | View raw
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