[Python-Dev] Clarification of unpacking semantics.

2020-02-05 Thread Brandt Bucher
Commits 13bc139 and 8a4cd70 introduced subtle changes in the evaluation logic of unpacking operations. Previously, all elements were evaluated prior to being collected in a container. Now, these operations are interleaved. For example, the code `[*a, *b]` used to evaluate in the order `a` -> `b`

[Python-Dev] Re: PEP 584: Add Union Operators To dict

2020-02-05 Thread Serhiy Storchaka
05.02.20 14:27, Musbur пише: I have one suggestion: Wouldn't it be useful for these operators to also accept sets (functionally acting like a dict with None for all values)? This would make it very elegant to 'normalize' dicts by pruning (dict & set) or padding (set | dict) dictionaries. I woul

[Python-Dev] Re: PEP 584: Add Union Operators To dict

2020-02-05 Thread Chris Angelico
On Thu, Feb 6, 2020 at 3:47 AM Brandt Bucher wrote: > > > I have one suggestion: Wouldn't it be useful for these operators to also > > accept sets (functionally acting like a dict with None for all values)? > > > Why None? Why not 0, or False, or 42? This sort of thing belongs more in > > a f

[Python-Dev] Re: PEP 584: Add Union Operators To dict

2020-02-05 Thread Brandt Bucher
> I have one suggestion: Wouldn't it be useful for these operators to also > accept sets (functionally acting like a dict with None for all values)? > Why None? Why not 0, or False, or 42? This sort of thing belongs more in a > function or method, IMHO. Well, in their defense, None is the nu

[Python-Dev] Re: PEP 584: Add Union Operators To dict

2020-02-05 Thread Rhodri James
On 05/02/2020 12:27, Musbur wrote: I have one suggestion: Wouldn't it be useful for these operators to also accept sets (functionally acting like a dict with None for all values)? This would make it very elegant to 'normalize' dicts by pruning (dict & set) or padding (set | dict) dictionaries.

[Python-Dev] Re: PEP 584: Add Union Operators To dict

2020-02-05 Thread Musbur
This is a great PEP. Just recently I needed this and was surprised that nothing of the sort had been implemented yet (I looked for quite some time). I have one suggestion: Wouldn't it be useful for these operators to also accept sets (functionally acting like a dict with None for all values)?

[Python-Dev] Re: Request to postpone some Python 3.9 incompatible changes to Python 3.10

2020-02-05 Thread Matěj Cepl
On 2020-02-04, 01:00 GMT, Brett Cannon wrote: > I think people also forget that prior to worrying about > maintaining backwards-compatibility with Python 2 we > deprecated for a release and then we removed (so an 18 month > deprecation period). But then you mustn’t filter out deprecation warnin