Sujet : Re: Dynamic classes
De : rob.cliffe (at) *nospam* btinternet.com (Rob Cliffe)
Groupes : comp.lang.pythonDate : 19. May 2025, 23:29:56
Autres entêtes
Message-ID : <mailman.66.1747693965.3008.python-list@python.org>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 19/05/2025 23:11, Thomas Passin via Python-list wrote:
On 5/19/2025 5:49 PM, Mats Wichmann via Python-list wrote:
On 5/19/25 09:51, Jonathan Gossage via Python-list wrote:
I have created a dynamic class using the type() function:
x = type('MyFlags', (), {'Flag1': 1, 'Flag2': 2, 'Flag3: 4, ' '__init__' :
__init__})
This is not my area of expertise, but there is a misplaced quote before
'__init__'
that should be after
'Flags3
Correct this, and your example runs without error.
Best wishes
Rob Cliffe