[Python-ideas] Re: PEP 671 proof-of-concept implementation

2021-10-29 Thread Guido van Rossum
I’m with Steven. On Fri, Oct 29, 2021 at 06:22 Chris Angelico wrote: > On Fri, Oct 29, 2021 at 11:52 PM Steven D'Aprano > wrote: > > > Except that that's still backward-incompatible, since None is a very > > > common value. > > > > How is it backwards incompatible? Any tool that looks at

[Python-ideas] Re: `is in`/`not is in` operators

2021-10-29 Thread Alexandre Brault
On 2021-10-25 5:32 a.m., Jeremiah Vivian wrote: For quick checking if a `Movement` object is inside of an iterable. It seems the core of your problem is that you took the mechanism that's supposed to tell you if two objects are identical for another purpose, and now are complaining that you

[Python-ideas] Re: PEP 671 proof-of-concept implementation

2021-10-29 Thread Chris Angelico
On Fri, Oct 29, 2021 at 11:52 PM Steven D'Aprano wrote: > > Except that that's still backward-incompatible, since None is a very > > common value. > > How is it backwards incompatible? Any tool that looks at __defaults__ > finds *exactly* what was there before: a tuple of default values, not a >

[Python-ideas] Re: PEP 671 proof-of-concept implementation

2021-10-29 Thread Steven D'Aprano
On Fri, Oct 29, 2021 at 10:22:43PM +1100, Chris Angelico wrote: > > Pardon me if this has already been discussed, but wouldn't it be better > > to leave defaults and kwdefaults alone, and add a new pair of attributes > > for late bound defaults? `__late_defaults__` and `__late_kwdefaults__`. > >

[Python-ideas] Re: PEP 671 proof-of-concept implementation

2021-10-29 Thread Chris Angelico
On Fri, Oct 29, 2021 at 8:11 PM Steven D'Aprano wrote: > > On Fri, Oct 29, 2021 at 07:17:05PM +1100, Chris Angelico wrote: > > > * Argument defaults (either in __defaults__ or __kwdefaults__) are now > > tuples of (desc, value) or (desc,) for early-bound and late-bound > > respectively > > *

[Python-ideas] Re: PEP 671 proof-of-concept implementation

2021-10-29 Thread Steven D'Aprano
On Fri, Oct 29, 2021 at 11:22:29AM +0200, Gerrit Holl wrote: > On Fri, 29 Oct 2021 at 11:10, Steven D'Aprano wrote: > > Obviously you need a way to indicate that a value in __defaults__ should > > be skipped. Here's just a sketch. Given: > > > > def func(a='alpha', b='beta', @c=expression,

[Python-ideas] Re: PEP 671 proof-of-concept implementation

2021-10-29 Thread Gerrit Holl
On Fri, 29 Oct 2021 at 11:10, Steven D'Aprano wrote: > Obviously you need a way to indicate that a value in __defaults__ should > be skipped. Here's just a sketch. Given: > > def func(a='alpha', b='beta', @c=expression, d=None) > > where only c is late bound, you could have: > >

[Python-ideas] Re: PEP 671 proof-of-concept implementation

2021-10-29 Thread Steven D'Aprano
On Fri, Oct 29, 2021 at 07:17:05PM +1100, Chris Angelico wrote: > * Argument defaults (either in __defaults__ or __kwdefaults__) are now > tuples of (desc, value) or (desc,) for early-bound and late-bound > respectively > * Early-bound defaults get mapped as normal. Late-bound defaults are > left

[Python-ideas] PEP 671 proof-of-concept implementation

2021-10-29 Thread Chris Angelico
https://github.com/Rosuav/cpython/tree/pep-671 So uhh... anyone who knows about the internals of CPython and wants to join me on this, I would *really* appreciate coauthors! The implementation ended up a lot more invasive than I originally planned. Some of that is inherent to the problem, but