Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'float': 0.05; 'guido': 0.05; 'modified': 0.05; 'rejected': 0.05; 'used.': 0.05; 'dynamically': 0.07; 'feature.': 0.07; 'input,': 0.09; 'non- ascii': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'script,': 0.09; 'streams.': 0.09; 'subject:2.7': 0.09; 'supported.': 0.09; 'tab': 0.09; 'bug': 0.10; 'python': 0.10; 'python.': 0.11; 'jan': 0.11; 'language,': 0.11; 'extensions': 0.13; 'output': 0.13; 'interpreter': 0.15; 'subject: \n ': 0.15; '2.4:': 0.16; 'already,': 0.16; 'backspace': 0.16; 'deferred': 0.16; 'identifiers,': 0.16; 'idle.': 0.16; 'inputs': 0.16; 'literal,': 0.16; 'literals': 0.16; 'observations': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'simulated': 0.16; 'students)': 0.16; 'subject:non': 0.16; 'whatever,': 0.16; 'wrote:': 0.16; 'string': 0.17; 'mechanism': 0.18; 'script.': 0.18; 'tells': 0.18; 'transform': 0.18; 'language': 0.19; '2015': 0.20; 'extension': 0.20; 'first,': 0.20; 'tracker': 0.20; 'do.': 0.22; 'ascii': 0.22; 'claiming': 0.22; 'converted': 0.22; 'disable': 0.22; 'am,': 0.23; 'seems': 0.23; 'nearly': 0.23; 'examples': 0.24; 'plain': 0.24; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'supported': 0.27; 'expanding': 0.27; 'possibility': 0.27; 'separate': 0.27; 'function': 0.28; 'idea': 0.28; 'interface': 0.29; 'dialog': 0.29; 'prints': 0.29; 'selecting': 0.29; 'subject: [': 0.29; 'e.g.': 0.30; 'language.': 0.32; 'maybe': 0.33; 'problem': 0.33; 'url:python': 0.33; 'usually': 0.33; "d'aprano": 0.33; 'displayed': 0.33; 'idle': 0.33; 'int': 0.33; 'interaction': 0.33; 'steven': 0.33; 'add': 0.34; 'could': 0.35; 'done': 0.35; 'filter': 0.35; 'set.': 0.35; 'quite': 0.35; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'url:org': 0.36; 'basic': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'display': 0.37; 'setting': 0.37; 'received:org': 0.37; 'doing': 0.38; 'summer': 0.38; 'files': 0.38; 'means': 0.39; 'why': 0.39; 'goes': 0.39; 'does': 0.39; 'easily': 0.39; 'subject:-': 0.39; 'rather': 0.39; 'build': 0.40; 'to:addr:python.org': 0.40; 'some': 0.40; 'url:3': 0.60; 'programs': 0.62; 'back': 0.62; 'skip:n 10': 0.62; '>>>>>': 0.66; 'remember,': 0.66; 'production': 0.67; 'act': 0.67; '8bit%:43': 0.72; 'jul': 0.72; 'present.': 0.72; 'treat': 0.72; 'awesome,': 0.84; 'expresses': 0.84; 'keystrokes': 0.84; 'numerals': 0.84; 'streams': 0.84; 'received:fios.verizon.net': 0.91; 'url:reference': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?] Date: Sun, 19 Jul 2015 04:26:27 -0400 References: <7083e494-6192-4acb-aea9-216d858171bc@googlegroups.com> <55ab2b57$0$1664$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-98-114-97-173.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 In-Reply-To: <55ab2b57$0$1664$c3e8da3$5496439d@news.astraweb.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: 94 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1437294417 news.xs4all.nl 2937 [2001:888:2000:d::a6]:50472 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:94106 On 7/19/2015 12:45 AM, Steven D'Aprano wrote: > On Sun, 19 Jul 2015 01:52 pm, Rustom Mody wrote: >> JFTR: My kids (um... students) have just managed to add devanagari >> numerals to python. >> ie we can now do >> >>>>> =E0=A5=A7 + =E0=A5=A8 >> 3 > > 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= =2E > > Python already, and has for many years, supported non-ASCII digits in s= tring > conversions. This is in Python 2.4: > > py> int(u'=E0=A5=A7=E0=A5=A8') > 12 > py> float(u'.=E0=A5=A7=E0=A5=A8') > 0.12 > > > so the feature goes back a long time. > > I think that Python should allow int and float literals using any seque= nces > of digits from the same language, e.g. 12 or =E0=A5=A7=E0=A5=A8 but not= =E0=A5=A72. This could be done easily by adding 10 modified productions from https://docs.python.org/3/reference/lexical_analysis.html#integer-literal= s for each language. The problem of doing the above in the grammar,=20 including the no mixing rule, is that is *would* take a separate set of=20 productions for each language supported. > One might have > an interpreter hook which displayed ints and floats using non-ASCII dig= its, > or one might even build that function into the intepreter, e.g. have a > global setting which tells ints and floats what digits to use, e.g.: > > sys.setdigits('Devanagari') > > I would support this, or something like this, as a language feature. If= we > can write Python using Hindi identifiers, why not Hindi numerals? As I remember, when non-ascii-digit inputs to int were last discussed=20 (python-ideas?, pydev?), the possibility of expanding literals was=20 mentioned. As I remember, to idea was rejected or deferred on the basis = that nearly all numbers used in production programs are read from files=20 as numbers or converted by int or float. The few numeric literals in=20 programs could just as well be converted first, or the int expression=20 could be used. These true observations do not cover the shell, as in the examples=20 above. At some time, Guido has expresses the opinion that interactive=20 console python should remain plain and basic and the fancier interaction = features are the domain of replacement shells. That brings me, anyway, to Idle. It currently imitates console python=20 in sending keystrokes as is to compile() and output streams as are to=20 the tk display. There are a couple of tracker issues claiming that this = means that Idle does not imitate console python because a tk display=20 does not treat backspace and return the same way simulated terminal=20 consoles usually do. While the bug claims have been rejected, I have been thinking that the=20 Idle extension interface could and maybe should be extended so that=20 extensions could filter and either transform or act on the input/output=20 streams. With a general mechanism in place, it would be trivial to use=20 str.maketrans and str.translate in the input/output streams. This would = not disable ascii digit input, including mixtures in a single literal,=20 but output has to all be in one digit set. Selecting a language is a=20 somewhat solved problem because last summer we added a extension=20 configuration dialog that dynamically generates a dialog tab for each=20 extension present. --=20 Terry Jan Reedy