Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #45680 > unrolled thread

RE: PEP 378: Format Specifier for Thousands Separator

Started byCarlos Nepomuceno <carlosnepomuceno@outlook.com>
First post2013-05-21 21:49 +0300
Last post2013-05-25 00:07 +0300
Articles 5 — 3 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-21 21:49 +0300
    Re: PEP 378: Format Specifier for Thousands Separator 88888 Dihedral <dihedral88888@gmail.com> - 2013-05-23 19:29 -0700
      RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-24 18:25 +0300
      Re: PEP 378: Format Specifier for Thousands Separator Andreas Perstinger <andipersti@gmail.com> - 2013-05-24 19:28 +0200
      RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 00:07 +0300

#45680 — RE: PEP 378: Format Specifier for Thousands Separator

FromCarlos Nepomuceno <carlosnepomuceno@outlook.com>
Date2013-05-21 21:49 +0300
SubjectRE: PEP 378: Format Specifier for Thousands Separator
Message-ID<mailman.1929.1369162176.3114.python-list@python.org>
________________________________
> From: alyssonbruno@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: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 
> >>> 
>  

Thank you, but let me rephrase it. I'm already using str.format() but I'd like to use '%' (BINARY_MODULO) operator instead.

I've looked into the source code of CPython 2.7.5 and I've found no evidence of the thousands separator been implemented on formatint() in "Objects/unicodeobject.c".

I also didn't find the _PyString_FormatLong() used in formatlong(). Where is _PyString_FormatLong() located?

So, the question is: Where would I change the CPython 2.7.5 source code to enable '%' (BINARY_MODULO) to format using the thousands separator like str.format() does, such as:

>>>sys.stderr.write('%,d\n' % 1234567)
1,234,567 		 	   		  

[toc] | [next] | [standalone]


#45861

From88888 Dihedral <dihedral88888@gmail.com>
Date2013-05-23 19:29 -0700
Message-ID<b87bfa97-e0cc-489e-847b-02d9312060bd@googlegroups.com>
In reply to#45680
Carlos Nepomuceno於 2013年5月22日星期三UTC+8上午2時49分28秒寫道:
> ________________________________
> > From: alyssonbruno@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: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 
> > >>> 
> >  
> 
> Thank you, but let me rephrase it. I'm already using str.format() but I'd like to use '%' (BINARY_MODULO) operator instead.
> 
> I've looked into the source code of CPython 2.7.5 and I've found no evidence of the thousands separator been implemented on formatint() in "Objects/unicodeobject.c".
> 
> I also didn't find the _PyString_FormatLong() used in formatlong(). Where is _PyString_FormatLong() located?
> 
> So, the question is: Where would I change the CPython 2.7.5 source code to enable '%' (BINARY_MODULO) to format using the thousands separator like str.format() does, such as:
> 
> >>>sys.stderr.write('%,d\n' % 1234567)
> 1,234,567

Could a separate instance like the  I/O device of a subprocess
to be easily available in Python?

The next question would be whether the flow of several I/O data streams could be easily piped and manipulated in the high level
programming designs without consuming too much resources.




[toc] | [prev] | [next] | [standalone]


#45898

FromCarlos Nepomuceno <carlosnepomuceno@outlook.com>
Date2013-05-24 18:25 +0300
Message-ID<mailman.2069.1369409154.3114.python-list@python.org>
In reply to#45861
----------------------------------------
> Date: Thu, 23 May 2013 19:29:14 -0700
> Subject: Re: PEP 378: Format Specifier for Thousands Separator
> From: dihedral88888@gmail.com
[...]
> Could a separate instance like the I/O device of a subprocess
> to be easily available in Python?
>
> The next question would be whether the flow of several I/O data streams could be easily piped and manipulated in the high level
> programming designs without consuming too much resources.


I'm sorry but I don't understand your question.

Do you mean returning the output of another process to the caller? Like:

import subprocess
output = subprocess.check_output(['ping', 'google.com']) 		 	   		  

[toc] | [prev] | [next] | [standalone]


#45903

FromAndreas Perstinger <andipersti@gmail.com>
Date2013-05-24 19:28 +0200
Message-ID<mailman.2073.1369416514.3114.python-list@python.org>
In reply to#45861
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: dihedral88888@gmail.com
>> [some typical dihedral stuff]
>
> I'm sorry but I don't understand your question.

Don't worry. I guess most people on this list don't understand it either.

It looks like dihedral is a bot although nobody knows for sure. Search 
for some other posts from him/her/it in the archive and form your own 
opinion.

IMHO you can simply ignore him/her/it.

Bye, Andreas

[toc] | [prev] | [next] | [standalone]


#45919

FromCarlos Nepomuceno <carlosnepomuceno@outlook.com>
Date2013-05-25 00:07 +0300
Message-ID<mailman.2078.1369429731.3114.python-list@python.org>
In reply to#45861
lol that reminds me of George! lol
;)

----------------------------------------
> Date: Fri, 24 May 2013 19:28:29 +0200
> From: andipersti@gmail.com
> To: python-list@python.org
> Subject: Re: PEP 378: Format Specifier for Thousands Separator
>
> 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: dihedral88888@gmail.com
>>> [some typical dihedral stuff]
>>
>> I'm sorry but I don't understand your question.
>
> Don't worry. I guess most people on this list don't understand it either.
>
> It looks like dihedral is a bot although nobody knows for sure. Search
> for some other posts from him/her/it in the archive and form your own
> opinion.
>
> IMHO you can simply ignore him/her/it.
>
> Bye, Andreas
>
> --
> http://mail.python.org/mailman/listinfo/python-list 		 	   		  

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web