Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Marko Rauhamaa Newsgroups: comp.lang.python Subject: Re: Devanagari int literals [was Re: Should non-security 2.7 bugs be fixed?] Date: Sun, 19 Jul 2015 10:16:09 +0300 Organization: A noiseless patient Spider Lines: 33 Message-ID: <87twt07h3a.fsf@elektro.pacujo.net> 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 Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="b7cb1518d23ec19d482dcc9c31d30fdd"; logging-data="19073"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19f1fpmUvzYDtih5/pCWxLy" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:eXA+LXvXIpEYqz2yPCqnY0+Clkc= sha1:QlD9h054LLd9UaOPnh9Pu1pbGM8= Xref: csiph.com comp.lang.python:94102 Chris Angelico : > On Sun, Jul 19, 2015 at 2:45 PM, Steven D'Aprano wrote: >> sys.setdigits('Devanagari') > > Easiest way to play with this would be a sys.displayhook, I think; I think the numeral selection is analogous to the number base: >>> 0o10 8 >>> "{:o}".format(0o10) '10' what we need is: >>> "{:d/base({base})}".format(0o10, base=7) '11' >>> "{:d/numeral('{num}')".format(0o10, num="European") '8' >>> "{:d/numeral('{num}')".format(0o10, num="Roman") 'VIII' >>> "{:d/numeral('{num}')".format(0o10, num="RomanLowerCase") 'viii' >>> "{:d/numeral('{num}')".format(0o10, num="EasternArabic") '٨' >>> "{:d/numeral('{num}')".format(0o10, num="Devanagari") '८' IOW, don't make it global. Marko