alex23於 2012年1月5日星期四UTC+8上午8時23分06秒寫道:
> On Jan 4, 6:25 pm, 8 Dihedral
> wrote:
> > > And what are you contributing to the situation other than
> > > misinformation and markov-generated spam?
> >
> > Do you know what can attract newbies to support python?
>
> I'm sure other people doing all t
On Jan 4, 6:25 pm, 8 Dihedral
wrote:
> > And what are you contributing to the situation other than
> > misinformation and markov-generated spam?
>
> Do you know what can attract newbies to support python?
I'm sure other people doing all the work for them would be a great
attractor. Are you vo
alex23於 2012年1月4日星期三UTC+8上午10時26分35秒寫道:
> 8 Dihedral wrote:
> > This is a good evolution in Python. It is 2012 now and the text I/O part
> > is not as important as 10 years ago. The next move of Python could
> > be easy integration of C++ libraries.
>
> You mean like with Py++? http://pypi.py
8 Dihedral wrote:
> This is a good evolution in Python. It is 2012 now and the text I/O part
> is not as important as 10 years ago. The next move of Python could
> be easy integration of C++ libraries.
You mean like with Py++? http://pypi.python.org/pypi/pyplusplus/
> The auto code generatio
Neil Cerutti wrote:
> On 2012-01-03, Stefan Krah wrote:
> > $ ./python -m timeit -n 100 '"%s" % 7.928137192'
> > 100 loops, best of 3: 0.0164 usec per loop
>
> % is faster, but not by an order of magnitude.
>
> On my machine:
>
> C:\WINDOWS>python -m timeit -n 100 -s "n=7.92" "'%s'
Neil Cerutti wrote:
On 2012-01-03, Stefan Krah wrote:
Andrew Berg wrote:
To add my opinion on it, I find format() much more readable and easier
to understand (with the exception of the {} {} {} {} syntax), and would
love to see %-style formatting phased out.
For me the %-style is much more r
Devin Jeanpierre wrote:
"one obvious way" != "only one way"
Which way is the obvious way? Why is it obvious?
Apparently, %-style is obvious to C and similar coders, while {}-style
is obvious to Java and similar coders.
:)
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
On 3 January 2012 19:46, Neil Cerutti wrote:
> On 2012-01-03, Stefan Krah wrote:
> > Andrew Berg wrote:
> >> To add my opinion on it, I find format() much more readable and easier
> >> to understand (with the exception of the {} {} {} {} syntax), and would
> >> love to see %-style formatting ph
> "one obvious way" != "only one way"
Which way is the obvious way? Why is it obvious?
For me, sprintf-formatting is "obviously" easier to use (less typing)
unless you're pulling values from a dictionary or object, or already
have all the variables stored in a dict you can pass in with **d.
-- D
Ian Kelly wrote:
http://mail.python.org/pipermail/python-dev/2009-September/092399.html
Thanks, that link is very informative.
Here's the link to the last discussion last February:
http://mail.python.org/pipermail/python-dev/2011-February/108155.html
~Ethan~
--
http://mail.python.org/mailm
On 2012-01-03, Stefan Krah wrote:
> Andrew Berg wrote:
>> To add my opinion on it, I find format() much more readable and easier
>> to understand (with the exception of the {} {} {} {} syntax), and would
>> love to see %-style formatting phased out.
>
> For me the %-style is much more readable. A
On Jan 3, 2012 6:55 AM, "Ethan Furman" wrote:
>
> Ian Kelly wrote:
>>
>> I'm not sure it's true that "there are no plans to do so in the
>> foreseeable future." According to the release notes from Python 3.0,
>> % formatting was supposed to be deprecated in Python 3.1.
>
>
> Eric Smith wrote (fro
davidfx於 2012年1月1日星期日UTC+8上午2時19分34秒寫道:
> Hello everyone,
> I just have a quick question about .format and %r %s %d.
>
> Should we always be using .format() for formatting strings or %?
>
> Example a = 'apples'
> print "I love {0}.".format(a)
>
> If I wanted to put .format into a
On 2012-01-03, Neil Cerutti wrote:
> On 2012-01-03, Stefan Krah wrote:
>> Neil Cerutti wrote:
>>> > In the real-world telco benchmark for _decimal, replacing the
>>> > single line
>>> >
>>> > outfil.write("%s\n" % t)
>>> >
>>> > with
>>> >
>>> > outfil.write("{}\n".format(t))
>>> >
>>> >
On 2012-01-03, Stefan Krah wrote:
> Neil Cerutti wrote:
>> > In the real-world telco benchmark for _decimal, replacing the
>> > single line
>> >
>> > outfil.write("%s\n" % t)
>> >
>> > with
>> >
>> > outfil.write("{}\n".format(t))
>> >
>> > adds 23% to the runtime. I think %-style formatt
Neil Cerutti wrote:
> > In the real-world telco benchmark for _decimal, replacing the
> > single line
> >
> > outfil.write("%s\n" % t)
> >
> > with
> >
> > outfil.write("{}\n".format(t))
> >
> > adds 23% to the runtime. I think %-style formatting should not
> > be deprecated at all.
>
On 2012-01-03, Stefan Krah wrote:
> Andrew Berg wrote:
>> To add my opinion on it, I find format() much more readable and easier
>> to understand (with the exception of the {} {} {} {} syntax), and would
>> love to see %-style formatting phased out.
>
> For me the %-style is much more readable. A
Ian Kelly wrote:
I'm not sure it's true that "there are no plans to do so in the
foreseeable future." According to the release notes from Python 3.0,
% formatting was supposed to be deprecated in Python 3.1.
Eric Smith wrote (from a thread on pydev in 02-2011):
> The last thread on this I have
On Tue, Jan 3, 2012 at 10:47 PM, Stefan Krah wrote:
> For me the %-style is much more readable.
It's also very similar to C's printf, which means it's similar to
everything else that's similar to printf. That makes it instantly
grokkable to many many people, which is a Good Thing. It's like using
Andrew Berg wrote:
> To add my opinion on it, I find format() much more readable and easier
> to understand (with the exception of the {} {} {} {} syntax), and would
> love to see %-style formatting phased out.
For me the %-style is much more readable. Also, it is significantly
faster:
$ ./pytho
On 1/2/2012 11:58 PM, Ian Kelly wrote:
> I can't believe I'm taking Rick's side here, but the docs do say:
>
> "Note: The formatting operations described here are obsolete and may
> go away in future versions of Python. Use the new String Formatting in
> new code."
>
> http://docs.python.org/py3k
On Mon, Jan 2, 2012 at 11:15 PM, Steven D'Aprano
wrote:
> Which is exactly why it is not deprecated: it doesn't say it is
> deprecated and has no timeline for removal. It may not even be removed:
> "may" go away is not "will" go away.
>
> Going around saying that features are deprecated just becau
On Mon, 02 Jan 2012 22:58:23 -0700, Ian Kelly wrote:
> On Mon, Jan 2, 2012 at 8:52 PM, Steven D'Aprano
> wrote:
>> On Mon, 02 Jan 2012 17:59:43 -0800, Rick Johnson wrote:
>>
>>> On Jan 2, 4:00 pm, Ethan Furman wrote:
%-style formatting isn't going away.
>>>
>>> You may want to freshen up on
On Mon, Jan 2, 2012 at 8:52 PM, Steven D'Aprano
wrote:
> On Mon, 02 Jan 2012 17:59:43 -0800, Rick Johnson wrote:
>
>> On Jan 2, 4:00 pm, Ethan Furman wrote:
>>> %-style formatting isn't going away.
>>
>> You may want to freshen up on the definition of "deprecation".
>
> I'm sure Ethan knows the d
On Mon, 02 Jan 2012 17:59:43 -0800, Rick Johnson wrote:
> On Jan 2, 4:00 pm, Ethan Furman wrote:
>> %-style formatting isn't going away.
>
> You may want to freshen up on the definition of "deprecation".
I'm sure Ethan knows the definition of deprecation. I'm sure he also
knows that % formatti
On Mon, 02 Jan 2012 17:51:48 -0800, Rick Johnson wrote:
> You may find the format spec to be cryptic at first. Well, most find
> regexes cryptic also -- but would anyone recommend NOT using regexes
> just because of crypti-ness? I think not. It's a non-starter.
I would.
If you have a task that d
On Dec 31 2011, 12:19 pm, davidfx wrote:
> Hello everyone,
> I just have a quick question about .format and %r %s %d.
>
> Should we always be using .format() for formatting strings or %?
ALWAYS use the format method over the old and dumpy string
interpolation. Why? Well because the format method
On Jan 2, 4:00 pm, Ethan Furman wrote:
> %-style formatting isn't going away.
You may want to freshen up on the definition of "deprecation". If it
was NOT going away, why the need to deprecate it? hmm? It would be
more beneficial if you DO NOT encourage continued usage of this "end-
of-life" feat
Andrew Berg wrote:
On 12/31/2011 12:19 PM, davidfx wrote:
Should we always be using .format() for formatting strings or %?
>>
%-style formatting will eventually go away, but
probably not for a long time.
%-style formatting isn't going away.
~Ethan~
--
http://mail.python.org/mailman/listinfo
On 1/1/2012 4:11 PM, Miki Tebeka wrote:
s = "{0} {1} {2} {3}"
s.format(1, 2, 3, 4)
'1 2 3 4'
Or even
In [4]: fmt = '{0} {1} {2} {3}'.format
In [5]: print(fmt(1, 2, 3, 4))
1 2 3 4
I have done this, except for using a more informative name, like 'emsg'
for error message.
exce
> >>> s = "{0} {1} {2} {3}"
> >>> s.format(1, 2, 3, 4)
> '1 2 3 4'
Or even
In [4]: fmt = '{0} {1} {2} {3}'.format
In [5]: print(fmt(1, 2, 3, 4))
1 2 3 4
--
http://mail.python.org/mailman/listinfo/python-list
On 12/31/2011 2:24 PM, Tim Chase wrote:
On 12/31/11 12:57, Benjamin Kaplan wrote:
format is a method of the string class. You store the string the same way
you would any other.
formatter = "Hello, {}"
print(formatter.format("world"))
Just to note that this syntax doesn't quite work in some ea
On 12/31/11 7:34 PM, Lie Ryan wrote:
On 01/01/2012 05:44 AM, davidfx wrote:
Thanks for your response. I know the following code is not going to be correct
but I want to show you what I was thinking.
formatter = "%r %r %r %r"
print formatter % (1, 2, 3, 4)
What is the .format version of this c
On 01/01/2012 05:44 AM, davidfx wrote:
Thanks for your response. I know the following code is not going to be correct
but I want to show you what I was thinking.
formatter = "%r %r %r %r"
print formatter % (1, 2, 3, 4)
What is the .format version of this concept?
I don't think the (%r)epr
On 12/31/11 12:57, Benjamin Kaplan wrote:
format is a method of the string class. You store the string the same way
you would any other.
formatter = "Hello, {}"
print(formatter.format("world"))
Just to note that this syntax doesn't quite work in some earlier
versions (tested below in 2.6, whi
On 31.12.2011 19:44, davidfx wrote:
Thanks for your response. I know the following code is not going to be correct
but I want to show you what I was thinking.
formatter = "%r %r %r %r"
print formatter % (1, 2, 3, 4)
What is the .format version of this concept?
formatter = "{0} {1} {2} {3}
On Dec 31, 2011 1:46 PM, "davidfx" wrote:
>
> Thanks for your response. I know the following code is not going to be
correct but I want to show you what I was thinking.
>
> formatter = "%r %r %r %r"
>
> print formatter % (1, 2, 3, 4)
>
> What is the .format version of this concept?
>
format is a
How 'bout just:
>>> s = "{0} {1} {2} {3}"
>>> s.format(1, 2, 3, 4)
'1 2 3 4'
Evan
On 12/31/2011 13:44, davidfx wrote:
> Thanks for your response. I know the following code is not going to be
> correct but I want to show you what I was thinking.
>
> formatter = "%r %r %r %r"
>
> print formatte
You mean like this?
===
a = "I like {name}"
a.format(name="myself")
'I like myself'
Sat, 31 Dec 2011 20:44:08 +0200 tarihinde davidfx
şöyle yazmış:
Thanks for your response. I know the following code is not going to be
correct but I w
Thanks for your response. I know the following code is not going to be correct
but I want to show you what I was thinking.
formatter = "%r %r %r %r"
print formatter % (1, 2, 3, 4)
What is the .format version of this concept?
--
http://mail.python.org/mailman/listinfo/python-list
What exactly do you mean by putting .format into a variable? You mean like
this:
"{name} is very {adj}
{gender}".format(name="sandy",adj="diligent",gender="female")
Sat, 31 Dec 2011 20:19:34 +0200 tarihinde davidfx
şöyle yazmış:
Hello everyone,
I just have a quick question about .form
On 12/31/2011 12:19 PM, davidfx wrote:
> Should we always be using .format() for formatting strings or %?
In new code, yes. %-style formatting will eventually go away, but
probably not for a long time.
> If I wanted to put .format into a variable, how would I do that.
What do you mean?
--
CPytho
42 matches
Mail list logo