Re: frozenset can be altered by |=

2021-11-29 Thread Chris Angelico
On Tue, Nov 30, 2021 at 12:41 PM Richard Damon wrote: > > On 11/29/21 5:01 PM, Chris Angelico wrote: > > On Tue, Nov 30, 2021 at 8:55 AM Marco Sulla > > wrote: > >> I must say that I'm reading the documentation now, and it's a bit > >> confusing. In the docs, inplace operators as |= should not

Re: frozenset can be altered by |=

2021-11-29 Thread Richard Damon
On 11/29/21 5:01 PM, Chris Angelico wrote: On Tue, Nov 30, 2021 at 8:55 AM Marco Sulla wrote: I must say that I'm reading the documentation now, and it's a bit confusing. In the docs, inplace operators as |= should not work. They are listed under the set-only functions and operators. But, as

Re: frozenset can be altered by |=

2021-11-29 Thread Chris Angelico
On Tue, Nov 30, 2021 at 8:55 AM Marco Sulla wrote: > > I must say that I'm reading the documentation now, and it's a bit > confusing. In the docs, inplace operators as |= should not work. They > are listed under the set-only functions and operators. But, as we saw, > this is not completely true:

Re: frozenset can be altered by |=

2021-11-29 Thread Marco Sulla
I must say that I'm reading the documentation now, and it's a bit confusing. In the docs, inplace operators as |= should not work. They are listed under the set-only functions and operators. But, as we saw, this is not completely true: they work but they don't mutate the original object. The same

Re: frozenset can be altered by |=

2021-11-22 Thread Marco Sulla
Yes, and you do this regularly. Indeed integers, for example, are immutables and a = 0 a += 1 is something you do dozens of times, and you simply don't think that another object is created and substituted for the variable named `a`. On Mon, 22 Nov 2021 at 14:59, Chris Angelico wrote: > > On

Re: frozenset can be altered by |=

2021-11-22 Thread Chris Angelico
On Tue, Nov 23, 2021 at 12:52 AM David Raymond 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. > >

RE: frozenset can be altered by |=

2021-11-22 Thread David Raymond
>> (venv_3_10) marco@buzz:~$ python >> Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) >> [GCC 10.1.1 20200718] on linux >> Type "help", "copyright", "credits" or "license" for more information. >> >>> a = frozenset((3, 4)) >> >>> a >> frozenset({3, 4}) >> >>> a |= {5,} >> >>> a

Re: frozenset can be altered by |=

2021-11-21 Thread Jach Feng
Marco Sulla 在 2021年11月20日 星期六上午5:12:19 [UTC+8] 的信中寫道: > (venv_3_10) marco@buzz:~$ python > Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) > [GCC 10.1.1 20200718] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> a = frozenset((3, 4)) >

Re: frozenset can be altered by |=

2021-11-19 Thread MRAB
On 2021-11-19 21:11, Marco Sulla wrote: (venv_3_10) marco@buzz:~$ python Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) [GCC 10.1.1 20200718] on linux Type "help", "copyright", "credits" or "license" for more information. a = frozenset((3, 4)) a frozenset({3, 4}) a |= {5,}

Re: frozenset can be altered by |=

2021-11-19 Thread Marco Sulla
Mh. Now I'm thinking that I've done a = "Marco " a += "Sulla" many times without bothering. On Fri, 19 Nov 2021 at 22:22, Chris Angelico wrote: > > On Sat, Nov 20, 2021 at 8:16 AM Chris Angelico wrote: > > > > On Sat, Nov 20, 2021 at 8:13 AM Marco Sulla > > wrote: > > > > > > (venv_3_10)

Re: frozenset can be altered by |=

2021-11-19 Thread Chris Angelico
On Sat, Nov 20, 2021 at 8:16 AM Chris Angelico wrote: > > On Sat, Nov 20, 2021 at 8:13 AM Marco Sulla > wrote: > > > > (venv_3_10) marco@buzz:~$ python > > Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) > > [GCC 10.1.1 20200718] on linux > > Type "help", "copyright",

Re: frozenset can be altered by |=

2021-11-19 Thread Chris Angelico
On Sat, Nov 20, 2021 at 8:13 AM Marco Sulla wrote: > > (venv_3_10) marco@buzz:~$ python > Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) > [GCC 10.1.1 20200718] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> a = frozenset((3, 4)) > >>>

frozenset can be altered by |=

2021-11-19 Thread Marco Sulla
(venv_3_10) marco@buzz:~$ python Python 3.10.0 (heads/3.10-dirty:f6e8b80d20, Nov 18 2021, 19:16:18) [GCC 10.1.1 20200718] on linux Type "help", "copyright", "credits" or "license" for more information. >>> a = frozenset((3, 4)) >>> a frozenset({3, 4}) >>> a |= {5,} >>> a frozenset({3, 4, 5}) --