Path: csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'cpython': 0.05; 'subject:PEP': 0.07; '-0500': 0.09; 'attributes': 0.09; 'ex:': 0.09; 'formatting': 0.09; 'raises': 0.09; 'release,': 0.09; 'try:': 0.09; 'valueerror:': 0.09; 'python': 0.11; 'def': 0.12; 'windows': 0.15; '#this': 0.16; "','": 0.16; 'behaviour.': 0.16; 'caveats': 0.16; 'closed.': 0.16; 'deprecated,': 0.16; 'illustrate': 0.16; 'typeerror:': 0.16; 'unlikely': 0.16; 'valueerror,': 0.16; 'index': 0.16; 'trying': 0.19; 'received:65.55.116': 0.24; 'mention': 0.26; 'suggested': 0.26; 'header:In-Reply-To:1': 0.27; 'skip:- 40': 0.29; 'character': 0.29; 'url:mailman': 0.30; 'code': 0.31; "skip:' 10": 0.31; '3.x': 0.31; 'url:python': 0.33; 'date:': 0.34; "can't": 0.35; 'except': 0.35; 'something': 0.35; 'but': 0.35; 'url:listinfo': 0.36; 'possible': 0.36; 'url:org': 0.36; 'should': 0.36; 'email addr:python.org': 0.37; 'to:addr:python-list': 0.38; 'issue': 0.38; 'does': 0.39; '\xa0\xa0\xa0': 0.39; 'to:addr:python.org': 0.39; '8bit%:6': 0.40; 'url:mail': 0.40; 'new': 0.61; 'email addr:gmail.com': 0.63; 'email name:python-list': 0.65; 'here': 0.66; 'soon.': 0.71; '9.1': 0.84; 'freebsd': 0.84; '2013': 0.98 X-TMN: [PGlF1sFWAZNgwuV1DE8cl5HRTILOWyWR] X-Originating-Email: [carlosnepomuceno@outlook.com] From: Carlos Nepomuceno To: comp.lang.python Subject: RE: PEP 378: Format Specifier for Thousands Separator Date: Tue, 21 May 2013 23:22:24 +0300 Importance: Normal In-Reply-To: <519BD0D2.5080203@gmail.com> References: , , , , , , <519BD0D2.5080203@gmail.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 21 May 2013 20:22:24.0143 (UTC) FILETIME=[E78511F0:01CE5660] 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: 41 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369167746 news.xs4all.nl 15909 [2001:888:2000:d::a6]:37732 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45689 ----------------------------------------=0A= > Date: Tue=2C 21 May 2013 14:53:54 -0500=0A= > From: bahamutzero8825@gmail.com=0A= > To: python-list@python.org=0A= [...]=0A= >>=0A= > What myth? People should indeed be using .format()=2C but no one said % f= ormatting was going away soon. Also=2C the suggested change to the docs=0A= > wasn't made and the issue is closed. The current docs do not say that % f= ormatting isn't going to be deprecated=2C but it does mention its=0A= > caveats and suggests .format(). If you are trying to say that % formattin= g will never ever go away=2C then you are wrong. It is highly=0A= > unlikely to go away in a 3.x release=2C but /may/ get phased out in Pytho= n 4.0.=0A= =0A= I vote for keeping str.__mod__()!=0A= =0A= Anyway=2C is it possible to overload str.__mod__() without deriving a class= ? I mean to have something like:=0A= =0A= old_mod =3D str.__mod__=0A= def new_mod(x):=0A= =A0=A0=A0 global old_mod=0A= =A0=A0=A0 try:=0A= =A0 =A0=A0 =A0=A0 old_mod(x)=0A= =A0=A0=A0 except ValueError=2C ex:=0A= =A0=A0=A0=A0=A0=A0=A0 #catch ValueError: unsupported format character '=2C'= (0x2c) at index 1=0A= =A0 =A0 =A0 =A0 #process new '%=2Cd' format here=0A= =A0=A0=A0=A0=A0=A0=A0 return '{:=2C}'.format(x)=A0 #just to illustrate the = behaviour. it would have it's own faster code=0A= =0A= str.__mod__ =3D new_mod=A0 #this raises TypeError: can't set attributes of = built-in/extension type 'str'=0A= sys.stdout.write('num=3D%=2Cd\n' % 1234567)=0A= =0A= =0A= > --=0A= > CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1=0A= > --=0A= > http://mail.python.org/mailman/listinfo/python-list =