Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'c++,': 0.07; 'matches': 0.07; 'definition,': 0.09; 'means,': 0.09; 'subject: [': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'itself.': 0.14; '*function': 0.16; '*within*': 0.16; 'combinations': 0.16; 'definition.': 0.16; 'function"': 0.16; 'pity': 0.16; 'subject:"]': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wow,': 0.16; 'write,': 0.16; 'not,': 0.20; 'input': 0.22; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'subject:problem': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'define': 0.26; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'sets': 0.30; 'message-id:@mail.gmail.com': 0.30; '(although': 0.31; 'tuples': 0.31; 'types.': 0.31; 'class': 0.32; 'lists': 0.32; 'says': 0.33; 'subject:with': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'c++': 0.36; 'right?': 0.36; 'possible': 0.36; 'quote': 0.39; 'then,': 0.60; 'new': 0.61; 'range': 0.61; 'making': 0.63; 'term': 0.63; 'field': 0.63; 'subject:The': 0.64; 'different': 0.65; 'within': 0.65; 'behavior': 0.77; 'huh?': 0.84; 'washington': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=JZU7VoVUFpuN2rkPXtcJNB03j00PYqEzsQgs98uUAb0=; b=rDTgkd51URFrn/ovUyWyo4O/I6bqa034t9L1kNqoRAFx8e852h8qOyBzqamre2tUb+ 9OvsydoMJ8pd9G6hXzH0OEwfkiONhJOz0uFMaPakz9F2rL8B57sMwLK8Oh/zASV+EfD0 WGvv6ueizyYCLUHhM0ot5zqfzLgtHWi23TWtbVjRoVyHtVsGSoYKD5tsAa7TiMcvuS7P Ke13OwDZ8mldnzyVRKBV0P+UvluOlN9hZewBvMdriFAh8SjWegS9mWS9geSotV+UYc8y pX2JHBvxXYIbQmT+nDCKRpHy1HiDzv2fgMTBBu+a7OYr7Q/8fmTa7riI67kousmgeG4J c9OQ== MIME-Version: 1.0 X-Received: by 10.194.24.225 with SMTP id x1mr2922964wjf.62.1370574848619; Thu, 06 Jun 2013 20:14:08 -0700 (PDT) In-Reply-To: <51b14573$0$29966$c3e8da3$5496439d@news.astraweb.com> References: <687dea63-84da-4c45-9366-cb5a10665d1f@googlegroups.com> <51ab95d5$0$29966$c3e8da3$5496439d@news.astraweb.com> <51ad7daf$0$11118$c3e8da3@news.astraweb.com> <31ca14e1-973d-44e6-886c-011a55755d76@googlegroups.com> <96cd7a31-40ce-4e51-9489-446b7f002a0e@googlegroups.com> <51afec46$0$29966$c3e8da3$5496439d@news.astraweb.com> <51b0565d$0$11118$c3e8da3@news.astraweb.com> <8275844b-ac41-46ab-a49a-9b796f31ebcf@ks18g2000pbb.googlegroups.com> <51b14573$0$29966$c3e8da3$5496439d@news.astraweb.com> Date: Thu, 6 Jun 2013 20:14:08 -0700 Subject: Re: Bools and explicitness [was Re: PyWart: The problem with "print"] From: Mark Janssen To: "Steven D'Aprano" Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370574855 news.xs4all.nl 16003 [2001:888:2000:d::a6]:55698 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47303 >> I am aware of what it means, but Python doesn't really have it (although >> it may evolve to it with annotations). > > No polymorphism huh? > > > py> len([1, 2, 3]) # len works on lists > 3 > py> len((1, 2)) # and on tuples > 2 > py> len({}) # and on dicts > 0 > py> len('I pity the fool') # and on strings > 15 > py> len(b'\x23') # and on bytes > 1 > py> len(set(range(2))) # and on sets > 2 > py> len(frozenset(range(4))) # and on frozensets > 4 > py> len(range(1000)) # and on range objects > 1000 Okay, wow, it looks like we need to define some new computer science terms here. You are making an "outside view of a function" (until a better term is found). So that give you one possible view of polymorphism. However, *within* a class that I would write, you would not see polymorphism like you have in C++, where it is within the *function closure* itself. Instead you would see many if/then combinations to define the behavior given several input types. I would call this simulated polymorphism. But don't quote me on this because I have to review my 20 years of CS and see if it matches what the field says -- if the field has settled on a definition. If not, I go with the C++ definition, and there it is very different than python. But then, you weren't going to quote me anyway, right? -- MarkJ Tacoma, Washington