Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

19 May, 2024: Line wrapping has been changed to be more consistent with Usenet standards.
 If you find that it is broken please let me know here rocksolid.nodes.help


devel / comp.lang.python / Re: Is there a way to implement the ** operator on a custom object

SubjectAuthor
o Re: Is there a way to implement the ** operator on a custom objectCameron Simpson

1
Re: Is there a way to implement the ** operator on a custom object

<mailman.53.1707458381.3227.python-list@python.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=25264&group=comp.lang.python#25264

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: Is there a way to implement the ** operator on a custom object
Date: Fri, 9 Feb 2024 16:50:21 +1100
Lines: 13
Message-ID: <mailman.53.1707458381.3227.python-list@python.org>
References: <c40b43e5-12e7-4495-a876-10362a19007c@btinternet.com>
<ZcW9HVRqhiR53tcT@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de /T97y+dc+DfHlfWWZNlnbQDeevXbw5OCwrcmkc56wtpQ==
Cancel-Lock: sha1:3PgMzBX6OEyV3wX2crK2EbFzTcI= sha256:nw4bUchwFL28Yfbj9fvCi/zctsvMHe2hg8kjaC/p/+k=
Return-Path: <cameron@cskk.id.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.008
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'generated': 0.03; 'code?':
0.09; 'from:addr:cs': 0.16; 'from:addr:cskk.id.au': 0.16;
'from:name:cameron simpson': 0.16; 'message-id:@cskk.homeip.net':
0.16; 'received:13.237': 0.16; 'received:13.237.201': 0.16;
'received:13.237.201.189': 0.16; 'received:cskk.id.au': 0.16;
'received:id.au': 0.16; 'received:mail.cskk.id.au': 0.16;
'subject:way': 0.16; 'wrote:': 0.16; 'python': 0.16; 'developer':
0.16; 'to:addr:python-list': 0.20; 'object': 0.26; 'header:User-
Agent:1': 0.30; 'default': 0.31; 'raise': 0.31; 'think': 0.32;
'subject:there': 0.32; 'header:In-Reply-To:1': 0.34;
'received:au': 0.35; 'could': 0.38; 'method': 0.61; 'key': 0.64;
'received:13': 0.64; 'look': 0.65; 'received:userid': 0.66;
'choose': 0.67; 'keywords': 0.95
Mail-Followup-To: Python List <python-list@python.org>
Content-Disposition: inline
In-Reply-To: <c40b43e5-12e7-4495-a876-10362a19007c@btinternet.com>
User-Agent: Mutt/2.2.7 (2022-08-07)
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: <ZcW9HVRqhiR53tcT@cskk.homeip.net>
X-Mailman-Original-References: <c40b43e5-12e7-4495-a876-10362a19007c@btinternet.com>
 by: Cameron Simpson - Fri, 9 Feb 2024 05:50 UTC

On 08Feb2024 12:21, tony.flury@btinternet.com <tony.flury@btinternet.com> wrote:
>I know that mappings by default support the ** operator, to unpack the
>mapping into key word arguments.
>
>Has it been considered implementing a dunder method for the **
>operator so you could unpack an object into a key word argument, and
>the developer could choose which keywords would be generated (or could
>even generate 'virtual' attributes).

Can you show us why you think that would look like in code?

Note that Python already has `a ** b` to raise `a` to the power of `b`,
and it has a bunder method `__pow__` which you can define.


devel / comp.lang.python / Re: Is there a way to implement the ** operator on a custom object

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor