Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'languages,': 0.04; 'api.': 0.05; 'cpython': 0.05; 'subject:Python': 0.06; 'ignored': 0.07; '2.3,': 0.09; 'feature.': 0.09; 'implements': 0.09; 'integers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:language': 0.09; 'python': 0.11; 'jan': 0.12; 'agree.': 0.16; 'callables': 0.16; 'dict': 0.16; 'general.': 0.16; 'hashable,': 0.16; 'increment': 0.16; 'key)': 0.16; 'none).': 0.16; 'pairs': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'rules.': 0.16; 'sense,': 0.16; 'simulate': 0.16; 'subject: \n ': 0.16; 'subject:?)': 0.16; 'subject:unicode': 0.16; 'wrote:': 0.18; 'library': 0.18; '(the': 0.22; 'programming': 0.22; 'header:User- Agent:1': 0.23; 'integer': 0.24; 'laws': 0.24; 'module,': 0.24; '(or': 0.24; 'tables': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'feature': 0.29; 'am,': 0.29; 'important.': 0.30; 'sets': 0.30; "i'm": 0.30; 'code': 0.31; 'claiming': 0.31; "d'aprano": 0.31; 'equality': 0.31; 'purely': 0.31; 'sets.': 0.31; 'steven': 0.31; 'tuples': 0.31; 'class': 0.32; 'lists': 0.32; 'implemented': 0.33; 'could': 0.34; 'possible.': 0.35; 'but': 0.35; 'are,': 0.36; 'ordered': 0.36; 'set.': 0.36; "didn't": 0.36; 'useful': 0.36; 'should': 0.36; 'easily': 0.37; 'starting': 0.37; 'implement': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'rather': 0.38; 'aside': 0.39; 'extremely': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'changed': 0.39; 'received:org': 0.40; 'major': 0.40; 'how': 0.40; 'even': 0.60; 'algorithms': 0.60; 'most': 0.60; 'numbers': 0.61; 'received:173': 0.61; 'first': 0.61; 'making': 0.63; 'reach': 0.63; 'real': 0.63; 'more': 0.64; 'specialized': 0.65; 'counts': 0.83; 'subject:this': 0.83; 'everywhere.': 0.84; 'maths': 0.84; 'received:fios.verizon.net': 0.84; 'careful': 0.91; 'hand,': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Time we switched to unicode? (was Explanation of this Python language feature?) Date: Tue, 25 Mar 2014 22:10:23 -0400 References: <9daf0806-02de-4447-964c-c8f8953c23e5@googlegroups.com> <532d5bd9$0$29994$c3e8da3$5496439d@news.astraweb.com> <0b78649a-16b3-4410-8258-e859578d62be@googlegroups.com> <53060a97-44fb-4e53-a7a7-d5eeed416f62@googlegroups.com> <53318664$0$29994$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 In-Reply-To: <53318664$0$29994$c3e8da3$5496439d@news.astraweb.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 72 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395799848 news.xs4all.nl 2841 [2001:888:2000:d::a6]:46620 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69094 On 3/25/2014 9:36 AM, Steven D'Aprano wrote: > Yes, Python could have changed the meaning of {} to mean the empty set.= > But you know what? The empty set is not that important. Sets are not > fundamental to Python. Python didn't even have sets until 2.3, and at > first they were just a standard library module, not even built-in. Leaving aside the fact that dicts are, conceptually, specialized sets of = ordered pairs in which first members are both unique to equality and, in = Python, hashable, this is all true. > Dicts, on the other hand, are fundamental to Python. > They are used e= verywhere. I would rather say that functions/mappings are fundamental to Python,=20 and in programming in general. Dicts are functions implemented as sets.=20 Lists and tuples are functions implemented as tables (ordered sets).=20 Callables are functions implemented as rules. The fact that functions as = sets (dicts) are both extremely useful and not built-in to most=20 languages, makes their presence in Python a major differentiating feature= =2E > Python is, in a very real sense, built on dicts, not sets. It is build on functions, but dicts are a differentiating features. The=20 'problem' with sets as sets is that they are purely featureless data=20 structures. > You can implement sets starting from dicts, > but not the other way around: You should be more careful about claiming impossibility;-). Sets can be easily implemented from dicts because dicts are sets with an = extra feature (the value associated with each key) that is easily=20 ignored (or always set to the key or None). To implement a dict class=20 starting with sets would be difficult because CPython sets and dicts are = implemented in C and one cannot reach into their C internals from=20 Python, or even (mostly) with the C API. One would have to implement or=20 even simulate the C structures and code in Python and the result would=20 be much slower. > dicts are more fundamental than sets. One can easily implement floats from complex numbers by making the .imag = part always 0. It would be much harder to implement complex numbers from = floats, for the same reasons that it would be hard to implements dicts=20 from sets. But it must be possible. Would you say that complex numbers=20 are, because of this implementation quirk, more fundamental than floats? > I'm sure it is awfully impressive that mathematicians can derive the la= ws > of integer maths starting only from the empty set =E2=88=85, but as far= as > programming goes that's not a very useful thing. I agree. Deriving counts and integers from 0 and an increment function=20 is much more apropos to how we use then to describe and drive algorithms = and prove things about them. --=20 Terry Jan Reedy