Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'though:': 0.07; 'valueerror:': 0.07; 'literal': 0.09; 'non-ascii': 0.09; 'script,': 0.09; 'subject:2.7': 0.09; 'python': 0.10; 'subject: \n ': 0.15; '-tkc': 0.16; '2.4:': 0.16; 'already,': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'numeral': 0.16; 'subject:non': 0.16; 'whatever,': 0.16; 'wrote:': 0.16; 'string': 0.17; 'script.': 0.18; '>>>': 0.20; '"",': 0.22; 'fraction': 0.22; 'seems': 0.23; '(most': 0.24; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'linux': 0.26; 'supported': 0.27; 'prints': 0.29; 'subject: [': 0.29; 'convert': 0.29; 'e.g.': 0.30; 'agreed': 0.31; "d'aprano": 0.33; 'steven': 0.33; 'traceback': 0.33; 'file': 0.34; 'could': 0.35; 'quite': 0.35; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'skip:p 20': 0.38; 'goes': 0.39; 'subject:-': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'ten': 0.60; 'back': 0.62; 'more': 0.63; '>>>>>': 0.66; 'received:50': 0.66; '8bit%:43': 0.72; 'float:': 0.72; 'awesome,': 0.84; 'holes': 0.84; '2014,': 0.91 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1437310561625:352843777 X-MC-Ingress-Time: 1437310561625 Date: Sun, 19 Jul 2015 07:56:01 -0500 From: Tim Chase To: python-list@python.org Subject: Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?] In-Reply-To: <55ab2b57$0$1664$c3e8da3$5496439d@news.astraweb.com> References: <7083e494-6192-4acb-aea9-216d858171bc@googlegroups.com> <55ab2b57$0$1664$c3e8da3$5496439d@news.astraweb.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-AuthUser: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437326857 news.xs4all.nl 2823 [2001:888:2000:d::a6]:59314 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94138 On 2015-07-19 14:45, Steven D'Aprano wrote: >> ie we can now do >>>>> =E0=A5=A7 + =E0=A5=A8 =20 >> 3 =20 >=20 > That is actually quite awesome, and I would support a new feature > that set the numeric characters to a particular script, e.g. Latin, > Arabic, Devanagari, whatever, and printed them in that same script. > It seems unfortunate that =E0=A5=A7 + =E0=A5=A8 prints as 3 rather than = =E0=A5=A9. >=20 > Python already, and has for many years, supported non-ASCII digits > in string conversions. This is in Python 2.4: >=20 > py> int(u'=E0=A5=A7=E0=A5=A8') =20 > 12 > py> float(u'.=E0=A5=A7=E0=A5=A8') =20 > 0.12 >=20 > so the feature goes back a long time. Agreed that it's pretty awesome. It seems to have some holes though: Python 3.4.2 (default, Oct 8 2014, 10:45:20)=20 [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print('\N{VULGAR FRACTION ONE EIGHTH}') =E2=85=9B >>> print(float('\N{VULGAR FRACTION ONE EIGHTH}')) Traceback (most recent call last): File "", line 1, in ValueError: could not convert string to float: '=E2=85=9B' >>> print('\N{ROMAN NUMERAL NINE}') =E2=85=A8 >>> int('\N{ROMAN NUMERAL NINE}') Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 10: '=E2=85=A8' >>> print('\N{ROMAN NUMERAL TEN THOUSAND}') =E2=86=82 >>> int('\N{ROMAN NUMERAL TEN THOUSAND}') Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 10: '=E2=86=82' -tkc