Re: PEP Request: Advanced Data Structures

2016-07-17 Thread Rustom Mody
On Sunday, July 17, 2016 at 3:45:04 AM UTC+5:30, Shrey Desai wrote: > I have found it slightly frustrating that Python does not have built-in > support for advanced data structures (Linked Lists, Stacks/Queues, BST) in > its distribution. Many computer science students, developers, and software

Re: PEP Request: Advanced Data Structures

2016-07-17 Thread Marko Rauhamaa
MRAB : > Given that Python has dict, there's not much need for a binary search tree. Dicts don't have the concept of key order. I use my own AVL tree to implement timers. A balanced tree data structure is the only major data structure I've missed in Python. It is there

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Tim Chase
On 2016-07-17 08:19, Chris Angelico wrote: > Why do you need a linked list? That's an implementation detail; why > not simply use a regular list? > > Not trolling, genuinely asking. Is there something that you > specifically need those exact structures for? I know there have been times I want

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Steven D'Aprano
On Sun, 17 Jul 2016 08:14 am, shrey.de...@gmail.com wrote: > I have found it slightly frustrating that Python does not have built-in > support for advanced data structures (Linked Lists, Stacks/Queues, BST) in > its distribution. They are hardly "advanced" data structures. They are trivial data

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Chris Angelico
On Sun, Jul 17, 2016 at 1:27 PM, wrote: >> Right, but how did you *get* that deep into the list? By following a >> chain of pointers. That's a relatively costly operation, so the >> benefit of not having to move all the following elements is damaged >> some by the cost of

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread cs
On 17Jul2016 12:43, Chris Angelico wrote: On Sun, Jul 17, 2016 at 12:33 PM, Paul Rubin wrote: Chris Angelico writes: keep a reference to an element deep in the list, and insert a new element in O(1) time at that point. at the C

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread MRAB
On 2016-07-17 03:33, Paul Rubin wrote: Chris Angelico writes: keep a reference to an element deep in the list, and insert a new element in O(1) time at that point. at the C level, wouldn't tracing the links cost massively more than the occasional insertion too? I'm not sure

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Chris Angelico
On Sun, Jul 17, 2016 at 12:33 PM, Paul Rubin wrote: > Chris Angelico writes: >>> keep a reference to an element deep in the list, and insert a new >>> element in O(1) time at that point. >> at the C level, wouldn't tracing the links cost massively more

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Paul Rubin
Chris Angelico writes: >> keep a reference to an element deep in the list, and insert a new >> element in O(1) time at that point. > at the C level, wouldn't tracing the links cost massively more than > the occasional insertion too? I'm not sure O(1) is of value at any > size,

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Chris Angelico
On Sun, Jul 17, 2016 at 10:54 AM, wrote: > Well, in a larger context you can keep a reference to an element deep in the > list, and insert a new element in O(1) time at that point. > I'd like to know how many elements your list needs before that actually becomes faster than

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread cs
On 16Jul2016 19:49, Dennis Lee Bieber wrote: On Sat, 16 Jul 2016 15:33:12 -0700 (PDT), Shrey Desai declaimed the following: - Education: the Linked List is a core data structure that CS undergraduates (among others) use and study, so it is vital

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread MRAB
On 2016-07-17 01:10, Terry Reedy wrote: On 7/16/2016 6:14 PM, shrey.de...@gmail.com wrote: I have found it slightly frustrating that Python does not have built-in support for advanced data structures (Linked Lists, You and I have different ideas of 'advanced data structures' ;-). To me,

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Terry Reedy
On 7/16/2016 6:14 PM, shrey.de...@gmail.com wrote: I have found it slightly frustrating that Python does not have built-in support for advanced data structures (Linked Lists, You and I have different ideas of 'advanced data structures' ;-). To me, linked list are limited structures used in

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread breamoreboy
On Saturday, July 16, 2016 at 11:15:04 PM UTC+1, Shrey Desai wrote: > I have found it slightly frustrating that Python does not have built-in > support for advanced data structures (Linked Lists, Stacks/Queues, BST) in > its distribution. Many computer science students, developers, and software

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Paul Rubin
shrey.de...@gmail.com writes: > As a computer science undergraduate student, I don't want to spend > time writing the module but instead I want to work with it, play > around with it, and do problems with it. For educational purposes, I think writing the module yourself is part of the idea.

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Chris Angelico
On Sun, Jul 17, 2016 at 8:33 AM, Shrey Desai wrote: > Hi Chris, thanks for the reply. There's a couple of reasons why I would need > a Linked List (and other data structures): > - Education: the Linked List is a core data structure that CS undergraduates > (among others)

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Shrey Desai
On Saturday, July 16, 2016 at 3:19:56 PM UTC-7, Chris Angelico wrote: > On Sun, Jul 17, 2016 at 8:14 AM, wrote: > > I have found it slightly frustrating that Python does not have built-in > > support for advanced data structures (Linked Lists, Stacks/Queues, BST) in > >

Re: PEP Request: Advanced Data Structures

2016-07-16 Thread Chris Angelico
On Sun, Jul 17, 2016 at 8:14 AM, wrote: > I have found it slightly frustrating that Python does not have built-in > support for advanced data structures (Linked Lists, Stacks/Queues, BST) in > its distribution. Many computer science students, developers, and software >

PEP Request: Advanced Data Structures

2016-07-16 Thread shrey . desai
I have found it slightly frustrating that Python does not have built-in support for advanced data structures (Linked Lists, Stacks/Queues, BST) in its distribution. Many computer science students, developers, and software engineers rely on these data structures; having the data structures be a