[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-11 Thread Adam Johnson
t's given me the opportunity to correct a typo & do some slight reformatting. Here's it is: On Thu, 9 Dec 2021 at 07:25, Adam Johnson wrote: > > On Fri, 3 Dec 2021 at 22:38, Chris Angelico wrote: > > > > On Sat, Dec 4, 2021 at 6:33 AM Adam Johnson w

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-03 Thread Adam Johnson
On Wed, 1 Dec 2021 at 06:19, Chris Angelico wrote: > > I've just updated PEP 671 https://www.python.org/dev/peps/pep-0671/ > with some additional information about the reference implementation, > and some clarifications elsewhere. > > *PEP 671: Syntax for late-bound function argument defaults* > >

[Python-ideas] Re: PEP 472 - new dunder attribute, to influence item access

2020-08-29 Thread Adam Johnson
On Sat, 29 Aug 2020 at 15:12, Ricky Teachey wrote: > > But if we want to have the same behavior without supporting function > style syntax, we will have to write code like this: > > MISSING = object() > > def __getitem__(self, key, x=MISSING, y=MISSING): > if x is MISSING and y is MISSING:: >

[Python-ideas] Re: zip(x, y, z, strict=True)

2020-05-06 Thread Adam Johnson
On Mon, 4 May 2020 at 12:41, Steven D'Aprano wrote: > > On Sun, May 03, 2020 at 11:13:58PM -0400, David Mertz wrote: > > > It seems to me that a Python implementation of zip_equals() shouldn't do > > the check in a loop like a version shows (I guess from more-itertools). > > More obvious is the fo

[Python-ideas] Re: Access to member name/names via context during Enum instance initialization

2019-11-30 Thread Adam Johnson
Peeking at the source for Enum, the __new__ method is explicitly called, thereby deferring the call to __init__ until it, too, is explicitly called, but only after member's _name_ attribute has been assigned. So, adapting your example: class ChoiceEnum(Enum): def __init__(self, value):

Re: [Python-ideas] __len__() for map()

2018-12-01 Thread Adam Johnson
On Sat, 1 Dec 2018 at 10:44, Greg Ewing wrote: > It's not -- the StopIteration isn't terminating the map, > it's terminating the iteration being performed by tuple(). That was a poor choice of wording on my part, it's rather that map doesn't do anything special in that regard. To whatever is iter

Re: [Python-ideas] __len__() for map()

2018-12-01 Thread Adam Johnson
On Sat, 1 Dec 2018 at 01:17, Steven D'Aprano wrote: > > In principle, we could make this work, by turning the output of map() > into a view like dict.keys() etc, or a lazy sequence type like range(). > wrapping the underlying sequence. That might be worth exploring. I can't > think of any obvious