Deutsch   English   Français   Italiano  
<m920mlF41dqU1@mid.individual.net>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feeds.phibee-telecom.net!2.eu.feeder.erje.net!feeder.erje.net!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>
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>
Bytes: 1593

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