Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: MRAB Newsgroups: comp.lang.python Subject: Re: PEP Request: Advanced Data Structures Date: Sun, 17 Jul 2016 01:38:39 +0100 Lines: 35 Message-ID: References: <21fcec53-cf5b-4529-9790-63a1c46f534b@googlegroups.com> <6b459de7-87cc-ddb5-093b-b0194977a892@mrabarnett.plus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de TW8F0SXu5YIhF4V3gvq9FQxnPKBKoZEA1Ff01BjHkKXw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'binary': 0.05; 'subject:PEP': 0.07; 'branching': 0.09; 'mutable': 0.09; 'optional': 0.09; 'python': 0.10; ':-)': 0.12; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'inverse': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'presume': 0.16; 'received:192.168.1.4': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'stuff!': 0.16; 'subject:Advanced': 0.16; 'wrote:': 0.16; 'tests': 0.18; 'tuples': 0.22; 'programming': 0.22; 'nearly': 0.23; 'slightly': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'routine': 0.29; 'usable': 0.29; 'code': 0.30; "i'd": 0.31; 'functional': 0.32; 'class': 0.33; 'instances': 0.33; 'case,': 0.34; 'structure': 0.34; 'lists': 0.34; 'list': 0.34; 'programming.': 0.35; 'skip:i 20': 0.36; 'structures': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'method': 0.37; 'missing': 0.37; 'things': 0.38; 'summer': 0.38; 'data': 0.39; 'does': 0.39; 'easily': 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'advanced': 0.61; 'email addr:gmail.com': 0.62; 'linked': 0.63; 'different': 0.63; 'subject:Data': 0.66; "they're": 0.66; 'today.': 0.67; 'dict,': 0.84; 'frustrating': 0.84; 'british': 0.88 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.2 cv=dMLko6Rb c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=IkcTkHD0fZMA:10 a=pGLkceISAAAA:8 a=nevnj7Elx1US9neEX_sA:9 a=6kGIvZw6iX1k4Y-7sg4_:22 X-AUTH: mrabarnett@:2500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <6b459de7-87cc-ddb5-093b-b0194977a892@mrabarnett.plus.com> X-Mailman-Original-References: <21fcec53-cf5b-4529-9790-63a1c46f534b@googlegroups.com> Xref: csiph.com comp.lang.python:111534 On 2016-07-17 01:10, Terry Reedy wrote: > On 7/16/2016 6:14 PM, shrey.desai@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 functional programming to > make mutable structure from immutable-except-on-creation cells. In any > case, one can easily use tuples to create branching structures. Tuples > and lists containing tuples and lists are routine in python programming. > Wrapping such usage in a LinkedList class is optional -- and unusual. > They're the kind of things I'd write when using C, but, then, C is missing a lot of stuff! :-) >> Stacks/Queues, > > Nearly two decades ago, I promoted the addition of the list.pop method > as the inverse of list.append, in order to make lists easily usable as > stacks. This is routine in python code today. > > collections.deque instances are advanced data structures that can be > used as stacks, queues, or both, at either end. The class has tests > that I presume are rigorous. > >> BST) > > British Summer Time? (Suggestion from Google) > Binary search tree. Given that Python has dict, there's not much need for a binary search tree. [snip]