[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-24 Thread Paul Moore
On Mon, 24 Feb 2020 at 02:44, MRAB wrote: > > On 2020-02-24 02:22, Chris Angelico wrote: > > On Mon, Feb 24, 2020 at 1:00 PM C. Titus Brown wrote: > >> > >> WHATS WRONG WITH TOP POSTING IN ALL CAPS AND NO PUNCTUATION!?!?!?! > >> > >> :) > > > > Oh, it's alright, you just put all the punctuation a

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-23 Thread MRAB
On 2020-02-24 02:22, Chris Angelico wrote: On Mon, Feb 24, 2020 at 1:00 PM C. Titus Brown wrote: WHATS WRONG WITH TOP POSTING IN ALL CAPS AND NO PUNCTUATION!?!?!?! :) Oh, it's alright, you just put all the punctuation at the end :) Not all of it; it's still missing an apostrophe. :-)

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-23 Thread Chris Angelico
On Mon, Feb 24, 2020 at 1:00 PM C. Titus Brown wrote: > > WHATS WRONG WITH TOP POSTING IN ALL CAPS AND NO PUNCTUATION!?!?!?! > > :) Oh, it's alright, you just put all the punctuation at the end :) ChrisA ___ Python-ideas mailing list -- python-ideas@py

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-23 Thread C. Titus Brown
WHATS WRONG WITH TOP POSTING IN ALL CAPS AND NO PUNCTUATION!?!?!?! :) No one has complained to the moderators that CoC is being violated. and if they did, there’s a whole bunch of safeguards to ensure that it’s not being misused. I do occasionally (once or twice a year?) place specific members

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-23 Thread Chris Angelico
On Mon, Feb 24, 2020 at 10:04 AM Steven D'Aprano wrote: > > At any rate, we should be able to control what we say and how we say it, > > adult or not. > > Indeed we should. And if that means we want to call a shitty piece of > software a shitty piece of software, especially when it's our own > sof

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-23 Thread Steven D'Aprano
I've been sitting on this email for the best part of a week. It hasn't been an easy decision to decide to send it, because I expect it will ruffle some feathers, including someone who, last time I ruffled his feathers, banned me from one of the other mailing lists. But I am part of this communi

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-19 Thread Ethan Furman
On 02/19/2020 08:55 AM, Soni L. wrote: On 2020-02-18 5:33 p.m., Soni L. wrote: Similar to len(). Just a [crappy] wrapper for __valid_getitem_requests__. Correction: Just a simple wrapper for __valid_getitem_requests__. Hopefully unsurprisingly, those words do not mean the same: simple: li

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-19 Thread Rhodri James
On 19/02/2020 16:55, Soni L. wrote: On 2020-02-18 5:33 p.m., Soni L. wrote: Similar to len(). Just a shitty wrapper for __valid_getitem_requests__. Correction: Just a simple wrapper for __valid_getitem_requests__. Thank you! :-) -- Rhodri James *-* Kynesim Ltd

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-19 Thread Soni L.
On 2020-02-18 5:33 p.m., Soni L. wrote: Similar to len(). Just a shitty wrapper for __valid_getitem_requests__. Correction: Just a simple wrapper for __valid_getitem_requests__. ___ Python-ideas mailing list -- python-ideas@python.org To unsubs

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-19 Thread Rhodri James
On 19/02/2020 00:26, Steven D'Aprano wrote: On Tue, Feb 18, 2020 at 08:44:07PM +, Rhodri James wrote: Language, sunshine. What about it? Just for the record, I had no issues with Soni's language, but I do object to attempts to shame him for it. This isn't the Disney Chanel, it's been ove

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-19 Thread Kyle Stanley
> Isn’t the point of having a Code of Conduct that we shouldn’t have to have these arguments? Or, if there is an argument about whether a single figurative use as a word qualifies as “excessive swearing” per the CoC, surely an -ideas thread isn’t the place to have it? Yeah, I very much doubt that

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-19 Thread Paul Moore
On Tue, 18 Feb 2020 at 23:40, Steven D'Aprano wrote: > > On Tue, Feb 18, 2020 at 09:04:21PM +, Paul Moore wrote: > > > This looks to me like Lua's `items()` function. > > I can't find that function listed anywhere. > > https://www.lua.org/manual/5.3/ > > Are you maybe thinking of `pairs()`? >

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Andrew Barnert via Python-ideas
On Feb 18, 2020, at 17:11, Ethan Furman wrote: > > On 02/18/2020 04:26 PM, Steven D'Aprano wrote: >> On Tue, Feb 18, 2020 at 08:44:07PM +, Rhodri James wrote: > >>> Language, sunshine. >> What about it? >> Just for the record, I had no issues with Soni's language, but I do >> object to atte

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Ethan Furman
On 02/18/2020 04:26 PM, Steven D'Aprano wrote: On Tue, Feb 18, 2020 at 08:44:07PM +, Rhodri James wrote: Language, sunshine. What about it? Just for the record, I had no issues with Soni's language, but I do object to attempts to shame him for it. Since when is simply drawing one's at

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Steven D'Aprano
On Tue, Feb 18, 2020 at 08:44:07PM +, Rhodri James wrote: > Language, sunshine. What about it? Just for the record, I had no issues with Soni's language, but I do object to attempts to shame him for it. This isn't the Disney Chanel, it's been over 100 years since Victoria was Queen of Engl

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Steven D'Aprano
On Tue, Feb 18, 2020 at 09:04:21PM +, Paul Moore wrote: > This looks to me like Lua's `items()` function. I can't find that function listed anywhere. https://www.lua.org/manual/5.3/ Are you maybe thinking of `pairs()`? https://www.lua.org/manual/5.3/manual.html#pdf-pairs > It's useful in

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Soni L.
On 2020-02-18 7:03 p.m., Guido van Rossum wrote: On Tue, Feb 18, 2020 at 1:45 PM Soni L. > wrote: [...] Iteration is done thusly: def _pairs(obj): if isinstance(obj, collections.abc.Mapping): return iter(obj.items()) el

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Guido van Rossum
On Tue, Feb 18, 2020 at 1:45 PM Soni L. wrote: > [...] > Iteration is done thusly: > > def _pairs(obj): > if isinstance(obj, collections.abc.Mapping): > return iter(obj.items()) > elif isinstance(obj, collections.abc.Sequence): > return iter(enumerate(obj, 0)) > e

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Soni L.
On 2020-02-18 6:04 p.m., Chris Angelico wrote: Too short, didn't read. Specifically, I'm not going to go digging through your links to find code to justify why you want this feature. Post some code here, or at very least, link directly to the code that would be improved by this feature. Soni,

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Guido van Rossum
On Tue, Feb 18, 2020 at 1:06 PM Chris Angelico wrote: > On Wed, Feb 19, 2020 at 7:58 AM Soni L. wrote: > > [...] I have a whole library focused on this sort of > > "canonical keys"-based iteration: > > > https://ganarchy.autistic.space/project/0f74bd87a23b515b45da7e6f5d9cc82380443dab/ > > > > (F

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Paul Moore
On Tue, 18 Feb 2020 at 20:47, Rhodri James wrote: > > On 18/02/2020 20:33, Soni L. wrote: > > > > > > On 2020-02-18 5:08 p.m., Rhodri James wrote: > >> On 18/02/2020 19:43, Soni L. wrote: > >>> It'd be nice to have a __valid_getitem_requests__ protocol that, if > >>> present, yields pairs such tha

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Chris Angelico
On Wed, Feb 19, 2020 at 7:58 AM Soni L. wrote: > > > > On 2020-02-18 5:43 p.m., Chris Angelico wrote: > > On Wed, Feb 19, 2020 at 7:34 AM Soni L. wrote: > > > > > > On 2020-02-18 5:08 p.m., Rhodri James wrote: > > > > On 18/02/2020 19:43, Soni L. wrote: > > > >> It'd be nice to have a __valid_get

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Guido van Rossum
Presumably this was inspired by the other thread, "Add __keys__ or __items__ protocol", where an __items__() method was proposed instead of recognizing mappings by the presence of a keys() method. On Tue, Feb 18, 2020 at 12:46 PM Rhodri James wrote: > On 18/02/2020 20:33, Soni L. wrote: > > > >

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Soni L.
On 2020-02-18 5:43 p.m., Chris Angelico wrote: On Wed, Feb 19, 2020 at 7:34 AM Soni L. wrote: > > On 2020-02-18 5:08 p.m., Rhodri James wrote: > > On 18/02/2020 19:43, Soni L. wrote: > >> It'd be nice to have a __valid_getitem_requests__ protocol that, if > >> present, yields pairs such that:

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Chris Angelico
On Wed, Feb 19, 2020 at 7:34 AM Soni L. wrote: > > On 2020-02-18 5:08 p.m., Rhodri James wrote: > > On 18/02/2020 19:43, Soni L. wrote: > >> It'd be nice to have a __valid_getitem_requests__ protocol that, if > >> present, yields pairs such that: > >> > >> for key, value in items(obj): > >>ass

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Rhodri James
On 18/02/2020 20:33, Soni L. wrote: On 2020-02-18 5:08 p.m., Rhodri James wrote: On 18/02/2020 19:43, Soni L. wrote: It'd be nice to have a __valid_getitem_requests__ protocol that, if present, yields pairs such that: for key, value in items(obj):    assert obj[key] == value for any obj.

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Soni L.
On 2020-02-18 5:08 p.m., Rhodri James wrote: On 18/02/2020 19:43, Soni L. wrote: It'd be nice to have a __valid_getitem_requests__ protocol that, if present, yields pairs such that: for key, value in items(obj):    assert obj[key] == value for any obj. OK, I'll bite.  What is this "items(

[Python-ideas] Re: Add a __valid_getitem_requests__ protocol

2020-02-18 Thread Rhodri James
On 18/02/2020 19:43, Soni L. wrote: It'd be nice to have a __valid_getitem_requests__ protocol that, if present, yields pairs such that: for key, value in items(obj):   assert obj[key] == value for any obj. OK, I'll bite. What is this "items()" function you apply to the arbitrary object?