Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29872

Re: Invalid identifier claimed to be valid by docs (methinks)

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'compiler': 0.05; 'identifier': 0.09; 'sep': 0.09; 'bug': 0.10; 'assume': 0.11; '*a,': 0.16; '::=': 0.16; 'char)': 0.16; 'digits.': 0.16; 'identifiers': 0.16; 'none"': 0.16; 'stuff.': 0.16; 'valid.': 0.16; 'wrote:': 0.17; 'keyboard': 0.22; 'seems': 0.23; 'header:In- Reply-To:1': 0.25; 'looks': 0.26; 'message-id:@mail.gmail.com': 0.27; 'accessible': 0.33; 'docs': 0.33; 'to:addr:python-list': 0.33; 'times.': 0.33; 'that,': 0.34; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'skip:u 20': 0.36; 'but': 0.36; 'characters': 0.36; 'thank': 0.36; 'subject: (': 0.36; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'skip:n 10': 0.63; 'to:name:python': 0.84; 'hand,': 0.97
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=xEojGes3xNAIfVHREA+yAGBr59+5Z5efXo50B1BCoS4=; b=psxtoCAmuctw7CUf8AMGZWM3Z5TupQ/XWHzC8VoEaZMn6Vv9DvJEJZmj1yjNG7F78m rQnR70BFOf3BtEmlBgrF/9izjKJ4zsdPZjFGuik16HVTrvLY1uF7PGuQQgeF7UC3Em+T 4PUKU7zckjAXBCO2beu1kQhC5Arcafm/p7Ib9gA6aVodBMEFMQ/NEBQxzhIoBUevc2MY G8Ii19oDtok0aLBtfnYWkyc6UAdRO0DZSS8fPWg8e3BZim9kG3uJe028WUttt79y6G/h dTxU6+O8kzFp+wtWs5mA/qddmtjC4ydHGBy3P+Dup44Q5X6OO1uOsBLl9nEu2E7YdyaP QBBg==
MIME-Version 1.0
In-Reply-To <CAN1F8qX54CQQ2roDNtofJCx_=QWY--1sspFGCmLZ7DEtH-a1Ug@mail.gmail.com>
References <CAN1F8qX54CQQ2roDNtofJCx_=QWY--1sspFGCmLZ7DEtH-a1Ug@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Sun, 23 Sep 2012 16:57:53 -0600
Subject Re: Invalid identifier claimed to be valid by docs (methinks)
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1163.1348441105.27098.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348441105 news.xs4all.nl 6919 [2001:888:2000:d::a6]:37769
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29872

Show key headers only | View raw


On Sun, Sep 23, 2012 at 4:24 PM, Joshua Landau
<joshua.landau.ws@gmail.com> wrote:
> The docs describe identifiers to have this grammar:
>
> identifier   ::=  xid_start xid_continue*
> id_start     ::=  <all characters in general categories Lu, Ll, Lt, Lm, Lo,
> Nl, the underscore, and characters with the Other_ID_Start property>
> id_continue  ::=  <all characters in id_start, plus characters in the
> categories Mn, Mc, Nd, Pc and others with the Other_ID_Continue property>
> xid_start    ::=  <all characters in id_start whose NFKC normalization is in
> "id_start xid_continue*">
> xid_continue ::=  <all characters in id_continue whose NFKC normalization is
> in "id_continue*">
>
> So I would assume that
>     exec("a{} = None".format(char))
> would be valid if
>    unicodedata.normalize("NFKC", char)  == "1"
> as
>    exec("a1 = None")
> is valid.
>
> BUT "a¹ = None" is not valid*.
>
> *a<superscript 1>, accessible through <ALT-GR>+1 if your keyboard's set up
> to do that stuff.
>
> Thank you for your times.

Or if you don't have a keyboard for that, you can do the same thing via:

exec("x\u00b9 = None")  # U+00B9 is superscript 1

On the other hand, this does work:

exec("x\u2071 = None")  # U+2071 is superscript i

So it seems to be only an issue with superscript and subscript digits.
 Looks like a compiler bug to me.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Invalid identifier claimed to be valid by docs (methinks) Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-23 16:57 -0600

csiph-web