Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'syntax': 0.04; 'error:': 0.07; 'identifier': 0.09; 'pep': 0.09; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'lambda': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject:unicode': 0.16; 'syntaxerror:': 0.16; 'underscore.': 0.16; 'wrote:': 0.18; 'trying': 0.19; '>>>': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'keyboard': 0.24; 'math': 0.24; 'question': 0.24; 'header:In-Reply-To:1': 0.27; '(this': 0.29; 'character': 0.29; 'gives': 0.31; 'explained': 0.31; 'produces': 0.31; 'received:84': 0.35; 'should': 0.36; 'being': 0.38; 'follows:': 0.38; 'mapping': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'extended': 0.61; 'name': 0.63; 'within': 0.65; 'capable': 0.67; 'invalid': 0.68; 'chinese': 0.74; 'characters,': 0.84; 'why?': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=JLW1sq6b c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=tLkI8qN_j18A:10 a=0BnVj236Uu0A:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=zIFHr4KgMkK-K2Qs0m0A:9 a=QEXdDO2ut3YA:10 X-AUTH: mrabarnett:2500 Date: Tue, 25 Mar 2014 19:24:43 +0000 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: unicode as valid naming symbols References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: 37 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395775491 news.xs4all.nl 2969 [2001:888:2000:d::a6]:53378 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69056 On 2014-03-25 18:30, Mark H Harris wrote: > greetings, I would like to create a lamda as follows: > > √ = lambda n: sqrt(n) > > > On my keyboard mapping the "problem" character is alt-v which produces > the radical symbol. When trying to set the symbol as a name within the > name-space gives a syntax error: > > >>> from math import sqrt > >>> > >>> √ = lambda n: sqrt(n) > SyntaxError: invalid character in identifier > >>> > >>> > > however this works: > > >>> > >>> λ = lambda n: sqrt(n) > >>> > >>> λ(2) > 1.4142135623730951 > >>> > > The question is which unicode(s) are capable of being proper name > characters, and which ones are off-limits, and why? > It's explained in PEP 3131. Basically, a name should to start with a letter (this has been extended to include Chinese characters, etc) or an underscore. λ is a classified as Lowercase_Letter. √ is classified as Math_Symbol.