Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Never face facts; if you do, you'll never get up in the morning." -- Marlo Thomas


devel / comp.lang.python / Re: frozenset can be altered by |=

SubjectAuthor
o Re: frozenset can be altered by |=Chris Angelico

1
Re: frozenset can be altered by |=

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

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=16161&group=comp.lang.python#16161

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: frozenset can be altered by |=
Date: Tue, 23 Nov 2021 00:57:39 +1100
Lines: 26
Message-ID: <mailman.2.1637589472.31677.python-list@python.org>
References: <CABbU2U_79XPx1T6EGWEniYkN8_m0oOO6mxx+HNbaLqg_wmT-Gw@mail.gmail.com>
<CAPTjJmq=4+yEhibTJoNA3QVUNR1HmScgnQgx3NtQRpgG4aNY1Q@mail.gmail.com>
<AM0PR07MB57000CEF0CEABBD27EA941DA879F9@AM0PR07MB5700.eurprd07.prod.outlook.com>
<CAPTjJmpprmCdjOJBz5FVecV6KqKFRC6Y7bOsNoTP+W-t-k3vew@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de EYfXVYpPc+R6dJbiLAvcyAj1B54ZkAshYzvyXbavgsAQ==
Return-Path: <rosuav@gmail.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=gmail.com header.i=@gmail.com header.b=caYYpSzw;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.009
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'thing.': 0.07;
'confusing,': 0.09; 'instances': 0.09; 'received:209.85.221.43':
0.09; 'received:mail-wr1-f43.google.com': 0.09; 'set,': 0.09;
'12:52': 0.16; 'behaviour': 0.16; 'chrisa': 0.16; 'default.':
0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16;
'level,': 0.16; 'wrote:': 0.16; 'says': 0.17; 'tue,': 0.19;
'to:addr:python-list': 0.20; 'language': 0.21; 'section': 0.25;
"doesn't": 0.32; 'elements': 0.32; 'message-id:@mail.gmail.com':
0.32; 'but': 0.32; 'same': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'following': 0.35;
'from:addr:gmail.com': 0.35; 'lists': 0.37; 'using': 0.37; "it's":
0.37; 'received:209.85': 0.37; 'received:209': 0.39; 'two': 0.39;
'adding': 0.39; 'list': 0.39; 'table': 0.39; 'something': 0.40;
'back': 0.67; 'operations': 0.68; 'above,': 0.70; '2021': 0.71;
'little': 0.73; 'fall': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=DmzUib1OyZZY7upXEpyrYSl3EZ+6My7ZRMCQQPCl2jo=;
b=caYYpSzw1ZoWSgHe97+x9EuaS0iQQsYa1r5+qVMMeedjn3HB39gV9zlt8QWTsUivKc
ICyTacyIdtzQ3wOqIL+wKlLUKn92bfTEPmJVkxMahr4x/TLGSAgwt40D/ZkAxCkGkR2c
14Q03muuDJ5W/5cvrQYrZGG1vnuxO8O6TjCnn1KS/dp7HqnK50pSwsEurjfaNO0vIdFu
onHo2xkmFDVmnQitpz6eiCF+63VnX/j0IsgUlEERsF437ZUhZY6pFUeqXW8IQyZHcnkn
Erv9e3CpVtX2JqSJNw+5fmJHsWz/eiJmRWvBQ8tF/+PvGOk6ZhYRl5uqKqhY9LhTyCsM
Jcbw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=DmzUib1OyZZY7upXEpyrYSl3EZ+6My7ZRMCQQPCl2jo=;
b=wL+Yujsjesdgg9bVY2p3Is8fD3Wx7SP7X6WRjTuKXTfWQiTeZNpRufXTCbSh6V+jY7
PBBOTH8Af6F7KQrFPCYVVrFLPCc8kaCirIKHpYsuh57dFZKTwyeWWrowL0Fx57DvOUH0
SupUQorQhgKgsq0hK/JflfVFtWA6dmX9LtadiznR9bxQVdMZhzU6Rn42eyIepY4ZDHav
vFmWoE9pfBp7T9DrLErkH7N8cpKjXeaurmQhWI2Xl3g5ROla8e9z2hufUrBCEX5QpooR
x03+SQ2hJKPWefwA9IvHZ8mr9f3N803jVZy6nzI6YOy+d3uEM6z7WAfvjrpTPOQiIuSP
XO8g==
X-Gm-Message-State: AOAM532/tmNO8TUhPgiO2uqe4EulVx8kldIfCrCb3GCbrVTSYBiLrcEx
SBSzSbbx1sA76EQrPM1IdChEW59I50rE/gioqrccmbTx
X-Google-Smtp-Source: ABdhPJzL3UMB7vxvOcwf8mSWxQ3vgj7bCMvvYKTtlTpl5Ro/jSa6plkkDavIHsQlInkZJ3HB//1YdYhtcYC6Xog5xO4=
X-Received: by 2002:adf:e682:: with SMTP id r2mr39650560wrm.281.1637589470397;
Mon, 22 Nov 2021 05:57:50 -0800 (PST)
In-Reply-To: <AM0PR07MB57000CEF0CEABBD27EA941DA879F9@AM0PR07MB5700.eurprd07.prod.outlook.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.37
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: <CAPTjJmpprmCdjOJBz5FVecV6KqKFRC6Y7bOsNoTP+W-t-k3vew@mail.gmail.com>
X-Mailman-Original-References: <CABbU2U_79XPx1T6EGWEniYkN8_m0oOO6mxx+HNbaLqg_wmT-Gw@mail.gmail.com>
<CAPTjJmq=4+yEhibTJoNA3QVUNR1HmScgnQgx3NtQRpgG4aNY1Q@mail.gmail.com>
<AM0PR07MB57000CEF0CEABBD27EA941DA879F9@AM0PR07MB5700.eurprd07.prod.outlook.com>
 by: Chris Angelico - Mon, 22 Nov 2021 13:57 UTC

On Tue, Nov 23, 2021 at 12:52 AM David Raymond <David.Raymond@tomtom.com> wrote:
> It is a little confusing since the docs list this in a section that says they don't apply to frozensets, and lists the two versions next to each other as the same thing.
>
> https://docs.python.org/3.9/library/stdtypes.html#set-types-set-frozenset
>
> The following table lists operations available for set that do not apply to immutable instances of frozenset:
>
> update(*others)
> set |= other | ...
>
> Update the set, adding elements from all others.

Yeah, it's a little confusing, but at the language level, something
that doesn't support |= will implicitly support it using the expanded
version:

a |= b
a = a | b

and in the section above, you can see that frozensets DO support the
Or operator.

By not having specific behaviour on the |= operator, frozensets
implicitly fall back on this default.

ChrisA

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor