RE: PEP 378: Format Specifier for Thousands Separator

2013-05-24 Thread Carlos Nepomuceno
lol that reminds me of George! lol ;) > Date: Fri, 24 May 2013 19:28:29 +0200 > From: andiper...@gmail.com > To: python-list@python.org > Subject: Re: PEP 378: Format Specifier for Thousands Separator > > On 24.05.2013 17:25, Carlo

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-24 Thread Andreas Perstinger
On 24.05.2013 17:25, Carlos Nepomuceno wrote: Date: Thu, 23 May 2013 19:29:14 -0700 Subject: Re: PEP 378: Format Specifier for Thousands Separator From: dihedral88...@gmail.com [some typical dihedral stuff] I'm sorry but I don't under

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-24 Thread Carlos Nepomuceno
> Date: Thu, 23 May 2013 19:29:14 -0700 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > From: dihedral88...@gmail.com [...] > Could a separate instance like the I/O device of a subprocess > to be easily available in Pytho

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-24 Thread nn
On May 23, 2:42 pm, Dave Angel wrote: > On 05/23/2013 11:26 AM, Carlos Nepomuceno wrote: > > > > >> Date: Thu, 23 May 2013 06:44:05 -0700 > >> Subject: Re: PEP 378: Format Specifier for Thousands Separator > >> From:

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread 88888 Dihedral
Carlos Nepomuceno於 2013年5月22日星期三UTC+8上午2時49分28秒寫道: > > > From: alyssonbr...@gmail.com > > Date: Tue, 21 May 2013 09:03:13 -0300 > > Subject: Re: PEP 378: Format Specifier for Thousands Separator > > To: python-list@python.org

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread Carlos Nepomuceno
Thank you! Hail Eris!!! :) > Date: Thu, 23 May 2013 21:17:54 -0400 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > From: malaclyp...@gmail.com > To: carlosnepomuc...@outlook.com > CC: python-list@python.org > > On T

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread Jerry Hill
On Thu, May 23, 2013 at 6:20 PM, Carlos Nepomuceno < carlosnepomuc...@outlook.com> wrote: > Can str.format() do the following? > > f = '%d %d %d' > v = '1,2,3' > print f % eval(v) > ​Sure: Python 3.2.2 (default, Sep 4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)] on win32 >>> f = "{} {} {}" >>> v

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread Carlos Nepomuceno
> To: python-list@python.org > From: tjre...@udel.edu [...] >> It's a conflict in the design. A tuple is used to supply multiple >> arguments to the % operator. So if you want to have a tuple as the >> first argument, you need to enclose it in another tuple.

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread Terry Jan Reedy
On 5/23/2013 2:42 PM, Dave Angel wrote: On 05/23/2013 11:26 AM, Carlos Nepomuceno wrote: eggs(a,f) Traceback (most recent call last): File "", line 1, in eggs(a,f) File "", line 1, in eggs def eggs(spam, ham): return spam % ham TypeError: not all arguments converted during string formattin

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread Dave Angel
On 05/23/2013 11:26 AM, Carlos Nepomuceno wrote: Date: Thu, 23 May 2013 06:44:05 -0700 Subject: Re: PEP 378: Format Specifier for Thousands Separator From: prueba...@latinmail.com To: python-list@python.org [...] You left out the part where a and f

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread Carlos Nepomuceno
> Date: Thu, 23 May 2013 06:44:05 -0700 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > From: prueba...@latinmail.com > To: python-list@python.org [...] >>>> eggs(a,f) > Traceback (most recent call last): > F

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-23 Thread nn
On May 22, 6:31 pm, Carlos Nepomuceno wrote: > > > > Date: Wed, 22 May 2013 13:26:23 -0700 > > Subject: Re: PEP 378: Format Specifier for Thousands Separator > > From: prueba...@latinmail.com > > To: python-l...@python.org

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Carlos Nepomuceno
> From: oscar.j.benja...@gmail.com > Date: Thu, 23 May 2013 01:30:53 +0100 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > To: carlosnepomuc...@outlook.com > CC: prueba...@latinmail.com; python-list@python.org > >

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Oscar Benjamin
On 22 May 2013 23:31, Carlos Nepomuceno wrote: > > I still don't understand why % benefits from literals optimization > ("'%d'%12345") while '{:d}'.format(12345) doesn't. There's no reason why that optimisation can't happen in principle. However no one has written a patch for it. Why don't you l

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Carlos Nepomuceno
> Date: Wed, 22 May 2013 13:26:23 -0700 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > From: prueba...@latinmail.com > To: python-list@python.org [...] > > Maybe a cformat(formatstring, variables) function should b

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread nn
On May 22, 2:30 pm, Ned Batchelder wrote: > On 5/22/2013 10:58 AM, Steven D'Aprano wrote: > > > On Wed, 22 May 2013 05:45:12 -0500, Skip Montanaro wrote: > > >> I didn't mean to create a tempest in a teapot.  I was away from > >> comp.lang.python, python-bugs, and python-dev for a few years.  In >

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Ned Batchelder
On 5/22/2013 10:58 AM, Steven D'Aprano wrote: On Wed, 22 May 2013 05:45:12 -0500, Skip Montanaro wrote: I didn't mean to create a tempest in a teapot. I was away from comp.lang.python, python-bugs, and python-dev for a few years. In particular, I didn't ever see the aforementioned thread fro

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Steven D'Aprano
On Wed, 22 May 2013 05:45:12 -0500, Skip Montanaro wrote: > I didn't mean to create a tempest in a teapot. I was away from > comp.lang.python, python-bugs, and python-dev for a few years. In > particular, I didn't ever see the aforementioned thread from Feb 2012. > Had I known of that thread I

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Carlos Nepomuceno
> Date: Wed, 22 May 2013 07:25:13 -0400 > From: n...@nedbatchelder.com [...] > You have to keep in mind that 2.7 is not getting any new features, no > matter how small they seem. If you create a patch that implements the > comma flag in %-formatting, it *mig

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Ned Batchelder
On 5/21/2013 11:38 PM, Carlos Nepomuceno wrote: From:steve+comp.lang.pyt...@pearwood.info >Subject: Re: PEP 378: Format Specifier for Thousands Separator >Date: Wed, 22 May 2013 03:08:54 + >To:python-list@python.org [...] >>So, the only alternative to have "

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread Skip Montanaro
Please stop perpetuating this myth, see http://mail.python.org/pipermail/python-dev/2012-February/116789.html and http://bugs.python.org/issue14123 >>> What myth? >> >> The myth that % string formatting is deprecated. It is not deprecated. > Skip didn't say that it was deprecate

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-22 Thread 88888 Dihedral
Carlos Nepomuceno於 2013年5月22日星期三UTC+8上午11時38分45秒寫道: > > > From: steve+comp.lang.pyt...@pearwood.info > > Subject: Re: PEP 378: Format Specifier for Thousands Separator > > Date: Wed, 22 May 2013 03:08:54 + > > To: python-list

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> From: steve+comp.lang.pyt...@pearwood.info > Subject: Re: PEP 378: Format Specifier for Thousands Separator > Date: Wed, 22 May 2013 03:08:54 + > To: python-list@python.org [...] >> So, the only alternative to have "'%,d&#

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Andrew Berg
On 2013.05.21 21:59, Steven D'Aprano wrote: > On Tue, 21 May 2013 14:53:54 -0500, Andrew Berg wrote: > >> On 2013.05.21 14:26, Mark Lawrence wrote: > >>> Please stop perpetuating this myth, see >>> http://mail.python.org/pipermail/python-dev/2012-February/116789.html >>> and http://bugs.python.or

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Steven D'Aprano
On Wed, 22 May 2013 05:56:53 +0300, Carlos Nepomuceno wrote: > >> From: steve+comp.lang.pyt...@pearwood.info Subject: Re: PEP 378: Format >> Specifier for Thousands Separator Date: Wed, 22 May 2013 02:42:56 + >> To: python-list@py

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Steven D'Aprano
On Tue, 21 May 2013 14:53:54 -0500, Andrew Berg wrote: > On 2013.05.21 14:26, Mark Lawrence wrote: >> Please stop perpetuating this myth, see >> http://mail.python.org/pipermail/python-dev/2012-February/116789.html >> and http://bugs.python.org/issue14123 >> > What myth? The myth that % string

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> From: steve+comp.lang.pyt...@pearwood.info > Subject: Re: PEP 378: Format Specifier for Thousands Separator > Date: Wed, 22 May 2013 02:42:56 + > To: python-list@python.org > > On Tue, 21 May 2013 23:22:24 +0300, Carlos Nepomuceno

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Steven D'Aprano
On Tue, 21 May 2013 23:22:24 +0300, Carlos Nepomuceno wrote: > Anyway, is it possible to overload str.__mod__() without deriving a > class? I mean to have something like: No, not in Python. If you want to monkey-patch built-in classes on the fly, with all the troubles that causes, use Ruby. --

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> Date: Tue, 21 May 2013 14:53:54 -0500 > From: bahamutzero8...@gmail.com > To: python-list@python.org [...] >> > What myth? People should indeed be using .format(), but no one said % > formatting was going away soon. Also, the suggested change to the docs

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> To: python-list@python.org > From: breamore...@yahoo.co.uk > Subject: Re: PEP 378: Format Specifier for Thousands Separator > Date: Tue, 21 May 2013 20:26:41 +0100 > > On 21/05/2013 20:13, Skip Montanaro wrote: >>> Thank you,

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Ethan Furman
On 05/21/2013 12:06 PM, Chris “Kwpolska” Warrick wrote: On Tue, May 21, 2013 at 8:49 PM, Carlos Nepomuceno wrote: Thank you, but let me rephrase it. I'm already using str.format() but I'd like to use '%' (BINARY_MODULO) operator instead. There is no real reason to do this. `str.format()` is

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Andrew Berg
On 2013.05.21 14:26, Mark Lawrence wrote: > On 21/05/2013 20:13, Skip Montanaro wrote: >>> Thank you, but let me rephrase it. I'm already using str.format() but I'd >>> like to use '%' (BINARY_MODULO) operator instead. >> >> That's unlikely to change. If not deprecated already string >> interpola

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> Analysing the code of "stringobject.c" I've found formatint() and > formatlong(). I mean _PyString_FormatLong() -- http://mail.python.org/mailman/listinfo/python-list

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> From: kwpol...@gmail.com > Date: Tue, 21 May 2013 21:06:11 +0200 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > To: carlosnepomuc...@outlook.com > CC: python-list@python.org > > On Tue, May 21, 2013 at 8:49

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Mark Lawrence
On 21/05/2013 20:13, Skip Montanaro wrote: Thank you, but let me rephrase it. I'm already using str.format() but I'd like to use '%' (BINARY_MODULO) operator instead. That's unlikely to change. If not deprecated already string interpolation using the modulo operator has lost favor to the stri

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Skip Montanaro
> Thank you, but let me rephrase it. I'm already using str.format() but I'd > like to use '%' (BINARY_MODULO) operator instead. That's unlikely to change. If not deprecated already string interpolation using the modulo operator has lost favor to the string object's format method. You might be a

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Chris “Kwpolska” Warrick
On Tue, May 21, 2013 at 8:49 PM, Carlos Nepomuceno wrote: > Thank you, but let me rephrase it. I'm already using str.format() but I'd > like to use '%' (BINARY_MODULO) operator instead. There is no real reason to do this. `str.format()` is the new shiny thing you should be using all the time.

RE: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Carlos Nepomuceno
> From: alyssonbr...@gmail.com > Date: Tue, 21 May 2013 09:03:13 -0300 > Subject: Re: PEP 378: Format Specifier for Thousands Separator > To: python-list@python.org > > This work in 3.1+: > > $ python3 > Python 3.1.3 (r313:8

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Alysson Bruno
This work in 3.1+: $ python3 Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10) [GCC 4.4.5] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> one_number = 1234567 >>> print('number={:,}'.format(one_number)) number=1,234,567 >>> paz e amor (love and peace), Alysso

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-20 Thread Ned Deily
In article , Carlos Nepomuceno wrote: > Is there a way to format integers with thousands separator (digit grouping) > like the format specifier of str.format()?> > I'm currently using the following:> > >>> sys.stdout.write('Number = %s\n' % '{:,.0f}'.format(x)) > Number = 12,345> > 'x' is uns