Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197484

Re: Dynamic classes

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Rob Cliffe <rob.cliffe@btinternet.com>
Newsgroups comp.lang.python
Subject Re: Dynamic classes
Date Mon, 19 May 2025 23:29:56 +0100
Lines 16
Message-ID <mailman.66.1747693965.3008.python-list@python.org> (permalink)
References <CAApdmf3UwA6zf2-eSfd=1U=Unx3-6PUj6+XS0Sp62rkn73C8iQ@mail.gmail.com> <385fb601-4061-4785-809a-94ee1e6c4e11@wichmann.us> <1139f617-1f4e-4ccc-bbfe-bd8bf0ef02e3@tompassin.net> <229045eb-9273-47b5-b265-298ce67edff3@btinternet.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de x8srGbKIXUN5a+6FXhbmPQtdFWNNFoA7m6D+kxVaQOfA==
Cancel-Lock sha1:2J36SHSlDUkKS/+KAOqCaF9oKfA= sha256:0GshgOubOLfGkeZtTZRH8Rch2R4/avkWe4XcN0zpCBY=
Return-Path <rob.cliffe@btinternet.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
Authentication-Results mail.python.org; dkim=pass reason="2048-bit key; unprotected key" header.d=btinternet.com header.i=@btinternet.com header.b=ZTnoce7O; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status OK 0.136
X-Spam-Level *
X-Spam-Evidence '*H*': 0.73; '*S*': 0.00; '5:49': 0.16; 'mats': 0.16; 'wichmann': 0.16; 'wrote:': 0.16; 'pm,': 0.19; 'to:addr:python- list': 0.20; 'header:User-Agent:1': 0.30; 'python-list': 0.32; 'subject:Dynamic': 0.32; 'received:192.168.1': 0.32; 'but': 0.32; 'there': 0.33; 'runs': 0.35; 'header:In-Reply-To:1': 0.35; '>>>': 0.36; 'using': 0.37; 'class': 0.37; 'example': 0.37; 'received:192.168': 0.37; 'this,': 0.39; 'wishes': 0.40; 'should': 0.40; 'best': 0.61; 'your': 0.64; 'quote': 0.74; 'rob': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=btinternet.com; s=btmx2012311; t=1747693964; bh=1BFFBCttbFjBAaFKp3aFc6XP+Otyz12aO/FYujRK3QU=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To; b=ZTnoce7OkB2Xt3tSwpjaJu8AwxH0D27Y3McPvRb4CasXk48Yx6rqewtp5VCb3Y7ft3kquEAHQ4iPSr+FRQsfhrZ075lfE0ceS/uxUKARxQdpEytiGe9mfAB3gBt6hBOxs5UejL5iMhdWgTmUyGcsDhJJZ+icK2b/x+wHU7qK/6hBIxFGhm6mzVrXm6QndqlL6KD657kj9HLvcBFXjjYTkFdoEl6vayw1TX9e/YBWDvHi2zrQRcguWqxwTC/Pg3NCkwd2Ug1G5ASLnyFJxfElv3Kx9yClNspCJaGBwNZ3U+2X/qj2Ixzteshn18Edz896MfL1mUimnbmkc04pDfFwaQ==
X-SNCR-Rigid 67D89C7B071B7B8F
X-Originating-IP [86.184.197.216]
X-OWM-Source-IP 86.184.197.216
X-OWM-Env-Sender rob.cliffe@btinternet.com
X-VadeSecure-score verdict=clean score=0/300, class=clean
X-RazorGate-Vade gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefvddvheekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddunecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddvjeenucfhrhhomheptfhosgcuvehlihhffhgvuceorhhosgdrtghlihhffhgvsegsthhinhhtvghrnhgvthdrtghomheqnecuggftrfgrthhtvghrnhepteetueffteffgeetffehveehjeduffekleetudevkeetkeehteevudejgeekheevnecukfhppeekiedrudekgedrudeljedrvdduieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopegludelvddrudeikedruddrvddtkegnpdhinhgvthepkeeirddukeegrdduleejrddvudeipdhmrghilhhfrhhomheprhhosgdrtghlihhffhgvsegsthhinhhtvghrnhgvthdrtghomhdprhgvvhfkrfephhhoshhtkeeiqddukeegqdduleejqddvudeirdhrrghnghgvkeeiqddukeegrdgsthgtvghnthhrrghlphhluhhsrdgtohhmpdgruhhthhgpuhhsvghrpehrohgsrdgtlhhifhhfvgessghtihhnthgvrhhnvghtrdgtohhmpdhgvghokffrpefiuedpoffvtefjohhsthepsghtphhrughrghhotddtfedpnhgspghrtghpthhtohepuddprhgtphhtthhopehphihthhhonhdqlhhishhtsehphihthhhonhdrohhrgh
X-RazorGate-Vade-Verdict clean 0
X-RazorGate-Vade-Classification clean
X-SNCR-hdrdom btinternet.com
X-SNCR-hdrdom btinternet.com
X-SNCR-hdrdom btinternet.com
User-Agent Mozilla Thunderbird
Content-Language en-GB
In-Reply-To <1139f617-1f4e-4ccc-bbfe-bd8bf0ef02e3@tompassin.net>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.39
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <https://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <229045eb-9273-47b5-b265-298ce67edff3@btinternet.com>
X-Mailman-Original-References <CAApdmf3UwA6zf2-eSfd=1U=Unx3-6PUj6+XS0Sp62rkn73C8iQ@mail.gmail.com> <385fb601-4061-4785-809a-94ee1e6c4e11@wichmann.us> <1139f617-1f4e-4ccc-bbfe-bd8bf0ef02e3@tompassin.net>
Xref csiph.com comp.lang.python:197484

Show key headers only | View raw



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

Back to comp.lang.python | Previous | Next | Find similar


Thread

Re: Dynamic classes Rob Cliffe <rob.cliffe@btinternet.com> - 2025-05-19 23:29 +0100

csiph-web