[Python-ideas] Re: Auto-assign attributes from __init__ arguments

2020-05-16 Thread Alex Hall
On Sat, May 16, 2020 at 10:07 PM Eric V. Smith wrote: > But my question is: If this technique has been available for 12 years, > why is it not more popular? > Because linters will not recognise a third party solution. Personally I've written code like: ``` def __init__(self, **kwargs):

[Python-ideas] Re: Auto-assign attributes from __init__ arguments

2020-05-16 Thread Eric V. Smith
On 5/16/2020 2:35 PM, Joao S. O. Bueno wrote: So, this thread has stalled, but I saw no contrary opinions to a decorator like this. I think the plain version (not treating positional only arguments differently, no partially-initialized namespace, no annotations based auto-argument cast) could

[Python-ideas] Re: Auto-assign attributes from __init__ arguments

2020-05-16 Thread Lewis Ball
Thanks for the support Joao, obviously I would be keen to have it in. Happy to help out with the PRs and reviews etc. if it does go ahead ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to

[Python-ideas] Re: Auto-assign attributes from __init__ arguments

2020-05-16 Thread Joao S. O. Bueno
So, this thread has stalled, but I saw no contrary opinions to a decorator like this. I think the plain version (not treating positional only arguments differently, no partially-initialized namespace, no annotations based auto-argument cast) could make it into a bpo - what do you say? On Wed, 6

[Python-ideas] Re: [Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-16 Thread Guido van Rossum
On Sat, May 16, 2020 at 1:26 AM Steven D'Aprano wrote: > > > * zip(strict=True) +1 > > * zip(mode='strict') -0 > > * itertools.zip_strict() -0.5 > > * zip.strict() -1 (but really, I'd like to make this -1e10) > > I spent a significant amount of time and mental energy

[Python-ideas] Re: [Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-16 Thread Ethan Furman
On 05/16/2020 01:16 AM, Steven D'Aprano wrote: On Fri, May 15, 2020 at 05:46:43PM +0200, Antoine Pitrou wrote: For me: * zip(strict=True) +1 * zip(mode='strict') -0 * itertools.zip_strict() -0.5 * zip.strict() -1 (but really, I'd like to make this -1e10) I spent a

[Python-ideas] Re: Adding slice Iterator to Sequences (was: islice with actual slices)

2020-05-16 Thread Andrew Barnert via Python-ideas
On May 15, 2020, at 21:35, Steven D'Aprano wrote: > > On Fri, May 15, 2020 at 05:44:59PM -0700, Andrew Barnert wrote: > >> Once you go with a separate view-creating function (or type), do we even >> need the dunder? > > Possibly not. But the beauty of a protocol is that it can work even if

[Python-ideas] Re: [Python-Dev] Re: PEP 618: Add Optional Length-Checking To zip

2020-05-16 Thread Steven D'Aprano
On Fri, May 15, 2020 at 05:46:43PM +0200, Antoine Pitrou wrote: > On Fri, 15 May 2020 10:46:25 -0400 > David Mertz wrote: > > > > > 1. +1 itertools.zip_strict function > > > 2. +1 zip.strict(*args) > > > 3. +1 zip(*args, mode='strict') # mode='shortest' by default > > > 4. +0 zip(*args,

[Python-ideas] Re: Adding slice Iterator to Sequences (was: islice with actual slices)

2020-05-16 Thread Andrew Barnert via Python-ideas
On May 15, 2020, at 21:25, Steven D'Aprano wrote: > > On Fri, May 15, 2020 at 01:00:09PM -0700, Christopher Barker wrote: > >> I know you winked there, but frankly, there isn't a clear most Pythonic API >> here. Surely you do'nt think PYhton should have no methods? > > That's not what I said.