Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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; '(at': 0.04; 'guido': 0.05; 'sufficient': 0.05; '(of': 0.07; 'made.': 0.07; 'excluding': 0.09; 'literal': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'rejected': 0.09; 'subject:design': 0.09; '{},': 0.09; 'python': 0.11; 'jan': 0.12; 'changes': 0.15; "'__doc__',": 0.16; 'c():': 0.16; 'dict': 0.16; 'did,': 0.16; 'janssen': 0.16; 'metaclass': 0.16; 'once.': 0.16; 'pairs': 0.16; 'really?': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subclasses': 0.16; 'subject:Language': 0.16; 'substitution': 0.16; 'weird': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'appears': 0.22; 'saying': 0.22; 'header:User-Agent:1': 0.23; 'sort': 0.25; 'class.': 0.26; 'right.': 0.26; 'pass': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'sets': 0.30; "skip:' 10": 0.31; 'class': 0.32; 'another': 0.32; 'community': 0.33; 'everyone': 0.33; 'but': 0.35; 'there': 0.35; 'set.': 0.36; 'useful': 0.36; 'should': 0.36; 'too': 0.37; 'two': 0.37; 'skip:[ 10': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'received:173': 0.61; 'you.': 0.62; 'discuss': 0.62; 'name': 0.63; 'such': 0.63; 'more': 0.64; 'different': 0.65; 'bottom': 0.67; 'actually,': 0.84; 'adoption': 0.84; 'dict.': 0.84; 'imagination': 0.84; 'indirect': 0.84; 'pain': 0.84; 'received:fios.verizon.net': 0.84; 'from.': 0.93; 'inheritance,': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Language design Date: Wed, 11 Sep 2013 21:40:39 -0400 References: <522eb795$0$29999$c3e8da3$5496439d@news.astraweb.com> <5230ff66$0$29988$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: 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: 62 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378950058 news.xs4all.nl 15863 [2001:888:2000:d::a6]:37774 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54022 On 9/11/2013 8:49 PM, Mark Janssen wrote: >>> 1) It tried to make Object the parent of every class. >> >> Tried, and succeeded. > > Really? Are you saying you (and the community at-large) always derive > from Object as your base class? The name is 'object', and yes, everyone does it because it is automatic. (I am including indirect inheritance, and excluding weird metaclass games.) >>> class C(): pass >>> dir(C) ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__'] Just *where* do you think all those methods come from. >>> C.__bases__ (,) > But wait is it the "base" (at the bottom of the hierarchy) or is it > the "parent" at the top? This sort of quibbling should be beneath you. > A dict is-a set of {key:object, key:object} pairs bound together with > a colon ":". Yes... but there is a very important additional condition: each key appears only once. Humans are primates, but that is not a sufficient characterization. > By inheriting from sets you get a lot of useful > functionality for free. Actually, you get a lot of un-useful functionality for free. Because of the extra condition, the rule for adding a key:object pair to a dict is different from the rule for adding a key:object pair to a set of such pairs. The set-union of two dicts is not necessarily a dict. To put is another way, dicts as set subclasses would violate the Liskov Substitution Principle. 'Homogenous' sets (of strings, numbers) would be proper subclasses of set. > Right. The dict literal should be {:} and the set literal 'should' be {}, and would be if Python were redesigned from scratch. Is your imagination so stunted that you actually think we did not discuss that when designing Python 3? We did, but Guido rejected switching because he thought it would cause too much pain and discourage adoption of Python 3 even more than the other code-breaking changes that were made. -- Terry Jan Reedy