[Python-ideas] Re: Set operations with Lists

2019-09-22 Thread Andrew Barnert via Python-ideas
On Sep 21, 2019, at 04:35, Richard Musil wrote: > > I wrote all this to show that without an insight it might be sometimes > difficult or impossible to do it right (I was caught myself in several > pitfalls on my original benchmarks I posted here) and also because it was > actually a fun to le

[Python-ideas] Re: Set operations with Lists

2019-09-22 Thread Richard Musil
On Sun, Sep 22, 2019 at 8:25 PM Andrew Barnert wrote: > One case I think you didn’t test is when the strings are generated in > already-sorted order. In that case, as opposed to the case where you > generate in random order and then sort, I think the PyUnicode objects and > the actual character a

[Python-ideas] Re: Set operations with Lists

2019-09-22 Thread Andrew Barnert via Python-ideas
On Sep 22, 2019, at 12:50, Richard Musil wrote: > >> On Sun, Sep 22, 2019 at 8:25 PM Andrew Barnert wrote: > >> One case I think you didn’t test is when the strings are generated in >> already-sorted order. > For the sake of completeness I did some benchmarks also with already sorted > stri

[Python-ideas] Re: Set operations with Lists

2019-09-22 Thread Andrew Barnert via Python-ideas
Let me go back to the top here. On Sep 18, 2019, at 12:29, Richard Higginbotham wrote: > > I have frequently come across cases where I would like to compare items in > one list in another similar to relational algebra. I’ve put together an itertools-style implementation at https://github.com/

[Python-ideas] Re: Start argument for itertools.accumulate() [Was: Proposal: A Reduce-Map Comprehension and a "last" builtin]

2019-09-22 Thread dparul000
I think It's quite obviously trying to bias the reader against the proposal by presenting a senseless example ;-) Assuming there's any real reason to write that code at all, a better question is whether it's more comprehensible than accumulate(itertools.chain([6], range(4, 6)), operator.mul) ht

[Python-ideas] Link: Bidirectional Aliasing in Python

2019-09-22 Thread Nutchanon Ninyawee
Hi, Python community I would like to discuss with you about the idea of "bidirectional Aliasing". I am not good at English wording. I will try my best to communicate the idea Link is a language feature that allows multiple variable names to always refer to the same underlying object define in a n

[Python-ideas] Re: Set operations with Lists

2019-09-22 Thread Richard Higginbotham
Steven D'Aprano wrote: > On Fri, Sep 20, 2019 at 11:44:17PM -, Richard Higginbotham wrote: > > Let me expand on the reasons for my post here. It > > seems like > > motivation has turned into a bit of a bike-shead. > > I don't think that anyone is questioning your motivation. (Although one > o

[Python-ideas] Re: Set operations with Lists

2019-09-22 Thread Richard Higginbotham
Richard Musil wrote: > On Sat, Sep 21, 2019 at 1:44 AM Richard Higginbotham [email protected] > wrote: . > I wrote all this to show that without an insight it might be sometimes > difficult or impossible to do it right (I was caught myself in several > pitfalls on my original benchmarks I post

[Python-ideas] Multiple items for each loop in comprehension

2019-09-22 Thread 보성 최
How about allowing to create multiple items for each loop in comprehension? I'm not sure this grammar is available, though. for example: [loop for set] s = set() for i in range(10): s.add(i) s.add(i * 10) [current comprehension] s = { x for i in range(10) for x in (i, i * 10)

[Python-ideas] Re: Set operations with Lists

2019-09-22 Thread Tim Peters
Note that CPython's sort is in the business of merging sorted (sub)lists. Any mergesort is. But CPython's adapts to take advantage, when possible, of "lumpy" distributions. For example, if you sort list(range(100, 200)) + list(range(0, 100)) it goes very fast (O(N)). Because

[Python-ideas] Re: Set operations with Lists

2019-09-22 Thread Andrew Barnert via Python-ideas
On Sep 22, 2019, at 15:28, Tim Peters wrote: > > > That's not by accident - the inspiration for CPython's sort's basic > "galloping" approach was taken from this paper, which wasn't about > sorting at all: > >"Adaptive Set Intersections, Unions, and Differences" (2000) >Erik D. Demaine,

[Python-ideas] Re: Multiple items for each loop in comprehension

2019-09-22 Thread Andrew Barnert via Python-ideas
On Sep 21, 2019, at 01:03, 보성 최 wrote: > > How about allowing to create multiple items for each loop in comprehension? > I'm not sure this grammar is available, though. > > for example: > > [loop for set] > s = set() > for i in range(10): >s.add(i) >s.add(i * 10) > [current comprehensio

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Robert Collins
On Mon, 23 Sep 2019 at 10:14, Nutchanon Ninyawee wrote: > > Hi, Python community > I would like to discuss with you about the idea of "bidirectional Aliasing". > I am not good at English wording. I will try my best to communicate the idea I think the idea is clear enough, but what isn't clear is

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Steven D'Aprano
On Mon, Sep 23, 2019 at 12:13:13PM +1200, Robert Collins wrote: > On Mon, 23 Sep 2019 at 10:14, Nutchanon Ninyawee wrote: > > > > Hi, Python community > > I would like to discuss with you about the idea of "bidirectional Aliasing". > > I am not good at English wording. I will try my best to commun

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Steven D'Aprano
On Sun, Sep 22, 2019 at 09:08:18AM -, Nutchanon Ninyawee wrote: > Link is a language feature that allows multiple variable names to > always refer to the same underlying object define in a namespace. For > now, if the variable a link with b. I will denote as a >< b or > link('a', 'b') I do

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Andrew Barnert via Python-ideas
On Sep 22, 2019, at 02:08, Nutchanon Ninyawee wrote: > > Link is a language feature that allows multiple variable names to always > refer to the same underlying object define in a namespace. > For now, if the variable a link with b. I will denote as a >< b or link('a', > 'b') > > a = 2 > a ><

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Andrew Barnert via Python-ideas
On Sep 22, 2019, at 02:08, Nutchanon Ninyawee wrote: > > More in detail on this link > https://dev.to/circleoncircles/python-ideas-link-bidirectional-aliasing-in-python-3f20 After reading the whole thing… In “explicitly not-copy assignment”: assignment in Python never copies. Doing `df = data_

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Chris Angelico
On Mon, Sep 23, 2019 at 10:42 AM Andrew Barnert via Python-ideas wrote: > > On Sep 22, 2019, at 02:08, Nutchanon Ninyawee wrote: > > > > Link is a language feature that allows multiple variable names to always > > refer to the same underlying object define in a namespace. > > For now, if the var

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Nutchanon Ninyawee
"rebinding" is the accurate term. Yes, `del spam` would delete eggs as well, and vice versa. Thanks for reporting my home page 404. ___ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] ht

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Andrew Barnert via Python-ideas
On Sep 22, 2019, at 18:15, Chris Angelico wrote: > > On Mon, Sep 23, 2019 at 10:42 AM Andrew Barnert via Python-ideas > wrote: >> >>> On Sep 22, 2019, at 02:08, Nutchanon Ninyawee wrote: >>> >>> Link is a language feature that allows multiple variable names to always >>> refer to the same un

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Andrew Barnert via Python-ideas
On Sep 22, 2019, at 18:46, Nutchanon Ninyawee wrote: > > Yes, `del spam` would delete eggs as well, and vice versa. Would they remain linked, so if I bound something else to eggs it would also be bound to spam? More importantly, what about the answers to the other dozen or so questions? Just

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Nutchanon Ninyawee
Andrew Barnert wrote: > On Sep 22, 2019, at 02:08, Nutchanon Ninyawee [email protected] wrote: > > Link is a language feature that allows multiple > > variable names to always refer to the same underlying object define in a > > namespace. > > For now, if the variable a link with b. I will denote

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Nutchanon Ninyawee
Chris Angelico wrote: > On Mon, Sep 23, 2019 at 10:42 AM Andrew Barnert via Python-ideas > [email protected] wrote: > > > > On Sep 22, 2019, at 02:08, Nutchanon Ninyawee [email protected] wrote: > > > > > Link is a language feature that allows multiple > > variable names to always refer to t

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Nutchanon Ninyawee
Andrew Barnert wrote: > On Sep 22, 2019, at 02:08, Nutchanon Ninyawee [email protected] wrote: > > More in detail on this link > > https://dev.to/circleoncircles/python-ideas-link-bidirectional-aliasing-in-p... > > After reading the whole thing… > In “explicitly not-copy assignment”: assignment in

[Python-ideas] Re: Link: Bidirectional Aliasing in Python

2019-09-22 Thread Nutchanon Ninyawee
Andrew Barnert wrote: > On Sep 22, 2019, at 18:46, Nutchanon Ninyawee [email protected] wrote: > > Yes, del spam would delete eggs as well, > > and vice versa. > > Would they remain linked, so if I bound something else to eggs it would > > also be > bound to spam? > More importantly, what about t