Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.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; 'operator': 0.03; 'subject:Python': 0.06; 'class,': 0.07; 'context': 0.07; 'expressions': 0.07; 'function,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'separating': 0.09; 'statements': 0.09; 'subject:language': 0.09; 'works.': 0.09; 'python': 0.11; 'def': 0.12; 'jan': 0.12; "'),": 0.16; 'objects.': 0.16; 'objects.)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'rewriting': 0.16; 'subject: \n ': 0.16; 'subject:?)': 0.16; 'subject:unicode': 0.16; 'syntactic': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'written': 0.21; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'either.': 0.24; 'instead.': 0.24; 'mathematical': 0.24; 'passes': 0.24; 'class.': 0.26; 'this:': 0.26; 'pass': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; "doesn't": 0.30; 'code': 0.31; "d'aprano": 0.31; 'quotes': 0.31; 'steven': 0.31; 'there.': 0.32; 'sense': 0.34; 'could': 0.34; 'problem': 0.35; "can't": 0.35; 'classes': 0.35; 'something': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'functions.': 0.36; 'marks': 0.36; 'representing': 0.36; 'represent': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'quote': 0.39; 'support,': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'received:org': 0.40; 'expression': 0.60; 'received:173': 0.61; 'course': 0.61; 'name': 0.63; 'sum': 0.64; '(that': 0.65; 'talking': 0.65; 'mar': 0.68; 'subject:this': 0.83; 'concept.': 0.84; 'examples.': 0.84; 'high,': 0.84; 'received:fios.verizon.net': 0.84 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: Wed, 26 Mar 2014 00:30:21 -0400 References: <9daf0806-02de-4447-964c-c8f8953c23e5@googlegroups.com> <281c8ce1-4f03-4e93-b5cd-d45b85e89e7e@googlegroups.com> <53314FC1.2010603@rece.vub.ac.be> <5331652c$0$29994$c3e8da3$5496439d@news.astraweb.com> <53319e60$0$29994$c3e8da3$5496439d@news.astraweb.com> <53321b7e$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: <53321b7e$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: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395808247 news.xs4all.nl 2863 [2001:888:2000:d::a6]:47418 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69099 On 3/25/2014 8:12 PM, Steven D'Aprano wrote: > On Tue, 25 Mar 2014 19:55:39 -0400, Terry Reedy wrote: > >> On 3/25/2014 11:18 AM, Steven D'Aprano wrote: >> >>> The thing is, we can't just create a =E2=88=91 function, because it d= oesn't >>> work the way the summation operator works. The problem is that we wou= ld >>> want syntactic support, so we could write something like this: >>> >>> p =3D 2 >>> =E2=88=91(n, 1, 10, n**p) >> >> Of course we can. If we do not insist on separating the dummy name fro= m >> the expression that contains it. this works. >> >> def sigma(low, high, func): >> sum =3D 0 >> for i in range(low, high+1): >> sum +=3D func(i) >> return sum > > There is no expression there. There is a function. > > You cannot pass an expression to a function in Python, One passes an unquoted expression in code by quoting it with either=20 lambda, paired quote marks (Lisp used a single '), or using it in a form = that implicitly quotes it (that includes def statements). Unquoted=20 expressions in statements ultimately get passed to an internal functions.= > not in the sense I am talking about, well, if you eliminate all the possibilities ... > because expressions are not first-class objects. The concept is not a class, and the Python stdlib does not have an=20 expression class. But people have written classes to represent the=20 concept. I used existing classes instead. Expressions are not (normally) mathematical objects either. (An exception is rewriting theory, or other theories, where strings=20 representing expressions or WFFs (well-formed formulas) are the only=20 objects.) Mathematicians quote expression strings by context or=20 positiion. The sigma form is one of many examples. --=20 Terry Jan Reedy