Re: New Python 3.0 string formatting - really necessary?

2009-01-13 Thread Arlo Belshee
For R, and others who haven't read the PEP or worked a lot with the web, here are some really strong advantages of the new string formatting over the old. Note: I'm not saying that you have to use one or the other. I'm just pointing out some of the things that the new format gives us - things

Re: New Python 3.0 string formatting - really necessary?

2008-12-31 Thread r
You know, it is so much easier to find my posts now that someone has been thoughtful enough to mark them for me. Thank you kind chaps, i shall leave a shiny new nickel for you, just send me your name, address, and phone numbers. I'll get them in the mail right away. --

Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread walterbyrd
On Dec 21, 12:28 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: I can see where the new formatting might be helpful in some cases. But, I am not sure it's worth the cost. Err... _Which_ cost exactly ? Loss of backward compatibility, mainly. --

Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread Luis M . González
On 19 dic, 13:01, walterbyrd walterb...@iname.com wrote: I have not worked with Python enough to really know. But, it seems to me that more I look at python 3.0, the more I wonder if it isn't a step backwards. To me, it seems that this: print %s=%d % ('this',99) Is much easier, and

Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread ajaksu
On Dec 29, 7:37 pm, Luis M. González luis...@gmail.com wrote: I still can't get used to add the parenthesis to print, and this is the only thing I don't like, but I'm sure there's a good reason for this change... I should know better than to post such an awful hack: __past__.py: from sys

Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread Steven D'Aprano
On Mon, 29 Dec 2008 09:50:14 -0800, walterbyrd wrote: On Dec 21, 12:28 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: I can see where the new formatting might be helpful in some cases. But, I am not sure it's worth the cost. Err... _Which_ cost exactly ? Loss

Re: New Python 3.0 string formatting - really necessary?

2008-12-29 Thread Luis M . González
On Dec 29, 9:44 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: How do you lose backward compatibility by *adding* new functionality? The old functionality will continue to work as normal. -- Steven AFAIK it still works the old way, but it will be deprecated soon. --

Re: New Python 3.0 string formatting - really necessary?

2008-12-24 Thread Scott David Daniels
Bruno Desthuilliers wrote: ... Now improvements are always welcomes, and if you compare 1.5.2 with 2.5.1, you'll find out that the core developpers did improve Python's perfs. Cool, palindromic inverses as compatible versions! -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python 3.0 string formatting - really necessary?

2008-12-24 Thread r
On Dec 22, 7:26 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 22 Dec 2008 06:58:06 -0800, walterbyrd wrote: On Dec 21, 12:28 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Strange enough, no one seems to complain about PHP or Ruby's

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Aaron Brady
On Dec 21, 8:42 pm, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 21, 6:14 pm, MRAB goo...@mrabarnett.plus.com wrote: snip Yes, I suggested that earlier, but it isn't needed because you can create a format object with Format(string). However, most of the time you won't

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread walterbyrd
On Dec 21, 12:28 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Strange enough, no one seems to complain about PHP or Ruby's performances... A few years back, there was a certain amount of chest thumping, when python/django easily beat ror in a benchmark test. Now that

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Michael Torrie
r wrote: Steven, Would you like to elaborate on -why- escaped backslashes are needed in strings... i waiting??? Some character was needed. It just happens that backslashes have been used in this manner for composing nonprintable sequences, codes, etc. It's only in use because someone

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Steve Holden
walterbyrd wrote: On Dec 21, 12:28 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Strange enough, no one seems to complain about PHP or Ruby's performances... A few years back, there was a certain amount of chest thumping, when python/django easily beat ror in a

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Michael Torrie
r wrote: Thanks MRAB, except the float is not 2 decimal places, but its there Come on... They did this for the interpreter not us. It's easer to parse this string with positional arguments and a dict of format descriptions. Come on pydev, at least be honest about it! No. They did this for

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread MRAB
Michael Torrie wrote: r wrote: Steven, Would you like to elaborate on -why- escaped backslashes are needed in strings... i waiting??? Some character was needed. It just happens that backslashes have been used in this manner for composing nonprintable sequences, codes, etc. It's only in use

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread r
On Dec 22, 8:58 am, walterbyrd walterb...@iname.com wrote: On Dec 21, 12:28 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Strange enough, no one seems to complain about PHP or Ruby's performances... A few years back, there was a certain amount of chest thumping,

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Bruno Desthuilliers
walterbyrd a écrit : On Dec 21, 12:28 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Strange enough, no one seems to complain about PHP or Ruby's performances... A few years back, there was a certain amount of chest thumping, when python/django easily beat ror in a

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread r
On Dec 22, 12:36 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: As far as I'm concerned, I don't think Python is superior (OMG), I think it's a good language that happens to fit my brain *and* solve more than 80% of my programmer's needs. If you're not happy with

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Arnaud Delobelle
Steven D'Aprano st...@remove-this-cybersource.com.au writes: Instead of just whinging, how about making a suggestion to fix it? Go on, sit down for an hour or ten and try to work out how a BINARY OPERATOR like % (that means it can only take TWO arguments) can deal with an arbitrary number

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Aaron Brady
On Dec 22, 11:40 am, r rt8...@gmail.com wrote: On Dec 22, 8:58 am, walterbyrd walterb...@iname.com wrote: On Dec 21, 12:28 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Strange enough, no one seems to complain about PHP or Ruby's performances... A few

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread r
On Dec 22, 5:53 pm, Aaron Brady castiro...@gmail.com wrote: On Dec 22, 11:40 am, r rt8...@gmail.com wrote: On Dec 22, 8:58 am, walterbyrd walterb...@iname.com wrote: On Dec 21, 12:28 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Strange enough, no one

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Steven D'Aprano
On Mon, 22 Dec 2008 06:58:06 -0800, walterbyrd wrote: On Dec 21, 12:28 pm, Bruno Desthuilliers bdesth.quelquech...@free.quelquepart.fr wrote: Strange enough, no one seems to complain about PHP or Ruby's performances... A few years back, there was a certain amount of chest thumping, when

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Patrick Mullen
On Sat, Dec 20, 2008 at 10:15 PM, r rt8...@gmail.com wrote: On Dec 20, 11:11 pm, walterbyrd walterb...@iname.com wrote: On Dec 20, 5:05 pm, Roy Smith r...@panix.com He got really hung up on the % syntax. I guess it's good to know that there is, at least, one person in the world doesn't

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Marc 'BlackJack' Rintsch
On Sat, 20 Dec 2008 22:15:23 -0800, r wrote: It would be nice to get a vote together and see what does the average pythoneer want? What do they like, What do they dislike. What is the state of the Python Union? Does anybody know, Does anybody care? I think python is slipping away from it's

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Marc 'BlackJack' Rintsch
On Sat, 20 Dec 2008 15:27:43 -0800, walterbyrd wrote: On Dec 19, 10:25 am, Michael Torrie torr...@gmail.com wrote: Personally the new string formatter is sorely needed in Python. Really? You know, it's funny, but when I read problems that people have with python, I don't remember seeing

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Steven D'Aprano
On Sun, 21 Dec 2008 00:57:46 -0800, Patrick Mullen wrote: 2) In my experience, major version changes tend to be slower than before. When a lot of things change, especially if very low-level things change, as happened in python 3.0, the new code has not yet went through many years of revision

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 20, 8:26 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sat, 20 Dec 2008 17:55:35 -0800, Aaron Brady wrote: snip This behavior is currently legal: %i %%i % 0 % 1 '0 1' So, just extend it.  (Unproduced.) %i %i % 0 % 1 '0 1' Errors should never pass

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 20, 8:49 pm, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 20, 7:38 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Instead of just whinging, how about making a suggestion to fix it? Go on, sit down for an hour or ten and try to work out how a

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Duncan Booth
Steven D'Aprano st...@remove-this-cybersource.com.au wrote: Errors should never pass silently, unless explicitly silenced. You have implicitly silenced the TypeError you get from not having enough arguments for the first format operation. That means that you will introduce ambiguity and

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Marc 'BlackJack' Rintsch
On Sun, 21 Dec 2008 12:45:32 +, Duncan Booth wrote: You seem to have made an unwarranted assumption, namely that a binary operator has to compile to a function with two operands. There is no particular reason why this has to always be the case: for example, I believe that C# when given

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Steven D'Aprano
On Sun, 21 Dec 2008 12:45:32 +, Duncan Booth wrote: Steven D'Aprano st...@remove-this-cybersource.com.au wrote: Errors should never pass silently, unless explicitly silenced. You have implicitly silenced the TypeError you get from not having enough arguments for the first format

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Steve Holden
r wrote: On Dec 20, 11:11 pm, walterbyrd walterb...@iname.com wrote: On Dec 20, 5:05 pm, Roy Smith r...@panix.com He got really hung up on the % syntax. I guess it's good to know that there is, at least, one person in the world doesn't like the % formatting. As least the move was not

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread skip
Marc Many newbie code I have seen avoids it by string concatenation: Marc greeting = 'Hello, my name is ' + name + ' and I am ' + str(age) + ' old.' Marc That's some kind of indirect complaint. :-) I see Python code like that written by people with a C/C++ background. I don't

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Duncan Booth
Marc 'BlackJack' Rintsch bj_...@gmx.net wrote: a+b+c+d might execute a.__add__(b,c,d) allowing more efficient string concatenations or matrix operations, and a%b%c%d might execute as a.__mod__(b,c,d). But that needs special casing strings and ``%`` in the comiler, because it might not be

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Duncan Booth
Steven D'Aprano st...@remove-this-cybersource.com.au wrote: a+b+c+d might execute a.__add__(b,c,d) allowing more efficient string concatenations or matrix operations, and a%b%c%d might execute as a.__mod__(b,c,d). That's only plausible if the operations are associative. Addition is

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 21, 7:34 am, Marc 'BlackJack' Rintsch bj_...@gmx.net wrote: On Sun, 21 Dec 2008 12:45:32 +, Duncan Booth wrote: You seem to have made an unwarranted assumption, namely that a binary operator has to compile to a function with two operands. There is no particular reason why this

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 21, 8:50 am, Steve Holden st...@holdenweb.com wrote: r wrote: snip This all really comes down to the new python users. Yea, i said it. Not rabid fanboys like Steven and myself.(i can't speak for walter but i think he would agree) Are we going to make sure joe-blow python newbie

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Mel
Duncan Booth wrote: I don't see that. What I suggested was that a % b % c would map to a.__mod__(b,c). (a % b) % c would also map to that, but a % (b % c) could only possibly map to a.__mod__(b.__mod__(c)) There's a compiling problem here, no? You don't want a%b%c to implement as

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Marc 'BlackJack' Rintsch
On Sun, 21 Dec 2008 15:30:34 +, Duncan Booth wrote: Marc 'BlackJack' Rintsch bj_...@gmx.net wrote: a+b+c+d might execute a.__add__(b,c,d) allowing more efficient string concatenations or matrix operations, and a%b%c%d might execute as a.__mod__(b,c,d). But that needs special casing

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread MRAB
Aaron Brady wrote: On Dec 20, 8:49 pm, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 20, 7:38 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Instead of just whinging, how about making a suggestion to fix it? Go on, sit down for an hour or ten and try to

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 21, 10:31 am, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 20, 8:49 pm, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 20, 7:38 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Instead of just whinging, how about making a

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread MRAB
Aaron Brady wrote: On Dec 21, 10:31 am, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 20, 8:49 pm, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 20, 7:38 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Instead of just whinging, how

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread bearophileHUGS
MRAB: Interesting. The re module uses a form of bytecode. Not sure about the relative cost of the dispatch code, though. I was talking about the main CPython VM, but the same ideas may be adapted for the RE engine too. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Christian Heimes
Patrick Mullen schrieb: 2) In my experience, major version changes tend to be slower than before. When a lot of things change, especially if very low-level things change, as happened in python 3.0, the new code has not yet went through many years of revision and optimization that the old code

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread r
I noticed when i mentioned self nobody wants to touch that subject. There could be many reasons why... 0.) nobody but the 10 regulars i see here exists 1.) nobody cares(doubt it) 2.) nobody is brave enough to question it(maybe) 3.) most people like to type self over and over again(doubt it) 4.)

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Luis Zarrabeitia
Quoting r rt8...@gmail.com: I noticed when i mentioned self nobody wants to touch that subject. There could be many reasons why... 0.) nobody but the 10 regulars i see here exists 1.) nobody cares(doubt it) 2.) nobody is brave enough to question it(maybe) 3.) most people like to type

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread MRAB
r wrote: I noticed when i mentioned self nobody wants to touch that subject. There could be many reasons why... 0.) nobody but the 10 regulars i see here exists 1.) nobody cares(doubt it) 2.) nobody is brave enough to question it(maybe) 3.) most people like to type self over and over

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Patrick Mullen
On Sun, Dec 21, 2008 at 11:26 AM, r rt8...@gmail.com wrote: I noticed when i mentioned self nobody wants to touch that subject. There could be many reasons why... 0.) nobody but the 10 regulars i see here exists 1.) nobody cares(doubt it) 2.) nobody is brave enough to question it(maybe) 3.)

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Bruno Desthuilliers
r a écrit : (snip clueless rant) One more big complaint THE BACKSLASH PLAGUE. ever tried regexp? Yes. exp = re.compile(rno \problem \with \backslashes) , or file paths?. You mean _dos/windows_ file path separator ? It was indeed a stupid choice _from microsoft_ to choose the by then

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Bruno Desthuilliers
walterbyrd a écrit : On Dec 20, 5:05 pm, Roy Smith r...@panix.com He got really hung up on the % syntax. I guess it's good to know that there is, at least, one person in the world doesn't like the % formatting. As least the move was not entirely pointless. But, you must admit, of all the

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Bruno Desthuilliers
r a écrit : I noticed when i mentioned self nobody wants to touch that subject. There could be many reasons why... 0.) nobody but the 10 regulars i see here exists 1.) nobody cares(doubt it) 2.) nobody is brave enough to question it(maybe) 3.) most people like to type self over and over

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread r
Hey Bruno, Thanks for spelling it out for me :D -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread r
Bruno, I thought i had already gone up, up, and away to your kill filter. hmm, guess you had a change of heart ;D -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Benjamin Kaplan
On Sun, Dec 21, 2008 at 2:26 PM, r rt8...@gmail.com wrote: I noticed when i mentioned self nobody wants to touch that subject. There could be many reasons why... 0.) nobody but the 10 regulars i see here exists if you only see 10 people, you must not be following this list very well.

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 21, 10:58 am, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 21, 10:31 am, MRAB goo...@mrabarnett.plus.com wrote: snip The original format is a string. The result of '%' is a string if there's only 1 placeholder to fill, or a (partial) format object (class

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread MRAB
Aaron Brady wrote: On Dec 21, 10:58 am, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 21, 10:31 am, MRAB goo...@mrabarnett.plus.com wrote: snip The original format is a string. The result of '%' is a string if there's only 1 placeholder to fill, or a (partial) format

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread alex23
On Dec 21, 10:11 am, r rt8...@gmail.com wrote: Most of the complaints i hear are the redundant use of self. Which I lamented about but have become accustom(brainwashed) to it. I would remove this if it where up to me. It's a shame Python wasn't released under some kind of license, one that

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread James Mills
On Mon, Dec 22, 2008 at 11:37 AM, alex23 wuwe...@gmail.com wrote: On Dec 21, 10:11 am, r rt8...@gmail.com wrote: Most of the complaints i hear are the redundant use of self. Which I lamented about but have become accustom(brainwashed) to it. I would remove this if it where up to me. It's a

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 21, 6:14 pm, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 21, 10:58 am, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 21, 10:31 am, MRAB goo...@mrabarnett.plus.com wrote: snip The original format is a string. The result of '%' is a string if

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread MRAB
Aaron Brady wrote: On Dec 21, 6:14 pm, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 21, 10:58 am, MRAB goo...@mrabarnett.plus.com wrote: Aaron Brady wrote: On Dec 21, 10:31 am, MRAB goo...@mrabarnett.plus.com wrote: snip The original format is a string. The result of

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Jeremiah Dodds
On Sat, Dec 20, 2008 at 12:30 AM, r rt8...@gmail.com wrote: Why could't we improve on what we had instead of making radical changes? Thats all i am asking. -- http://mail.python.org/mailman/listinfo/python-list Often times improving on what you have involves radical changes, especially if

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Stefan Behnel
Steven D'Aprano wrote: I have no objection to the addition of the format() method (although I wonder whether it might have been better as a function). I actually learned about the String.format() method in Java a while after having read about str.format() in Python, and my first reaction was

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Marc 'BlackJack' Rintsch
On Fri, 19 Dec 2008 17:12:00 -0800, r wrote: Marc, Why move away from a concise and widely accepted way of sting formatting, just to supposedly make it a little easier for n00bs? (which i disagree this is easier) In turn, creating more syntactical clutter. (%s %f %d) is all you need to

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Steve Holden
Stefan Behnel wrote: [...] I think '...'.format() makes sense given that we already have '...'.join(). Sure it does, but that doesn't stop a lot of people disliking str.join() regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Steve Holden
r wrote: On Dec 19, 10:04 pm, Steve Holden st...@holdenweb.com wrote: r wrote: Thanks Steven, We need a real Pepsi challenge here to show the insignificance of this change. I am not against change. But when we lose something as - compact- as %formating i'm going to want to see a damn good

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread walterbyrd
On Dec 19, 12:43 pm, excord80 excor...@gmail.com wrote: Also, I like having only *one* special symbol (`%') to worry about in my strings instead of two (`{' and `}'). Actually the new way has, at least three special symbols: ( '{', '}' , '.') as well as the method name format so %s=%s % (k,

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread walterbyrd
On Dec 19, 10:25 am, Michael Torrie torr...@gmail.com wrote: Personally the new string formatter is sorely needed in Python.   Really? You know, it's funny, but when I read problems that people have with python, I don't remember seeing that. Loads of people complain about the white space issue.

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread r
Walter, Would you be kind enough to translate this code to the new syntax? s = 'python' n = 12 f = 1.3 '%s %05d %0.2f' %(s,n,f) 'python 00012 1.33' i want to see how casting is handled. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread walterbyrd
On Dec 19, 10:55 am, bearophileh...@lycos.com wrote: Regarding the speed of Python3 programs, they will go faster The net result of the 3.0 generalizations is that Python 3.0 runs the pystone benchmark around 10% slower than Python 2.5. http://docs.python.org/dev/3.0/whatsnew/3.0.html

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread walterbyrd
On Dec 20, 4:34 pm, r rt8...@gmail.com wrote: Walter, Would you be kind enough to translate this code to the new syntax? I am sorry, but I just don't know the new syntax well enough. I am not sure if the examples that I have posted, so far, are correct. --

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread r
Thanks, i understand. Maybe some of the pro new syntax guys will show a translation -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread MRAB
walterbyrd wrote: On Dec 19, 12:43 pm, excord80 excor...@gmail.com wrote: Also, I like having only *one* special symbol (`%') to worry about in my strings instead of two (`{' and `}'). Actually the new way has, at least three special symbols: ( '{', '}' , '.') as well as the method name

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread r
Just to be on record, i am OK with adding a new way to do this as long as the old C style str format does not ever go away. I don't like 20 ways to do the same thing, but i really like the compact way of %formating now. My complaint is the deprecation of %formating. Maybe i'll use the new syntax

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Roy Smith
In article b58f588a-e8db-41df-a488-f7df62d56...@w39g2000prb.googlegroups.com, walterbyrd walterb...@iname.com wrote: On Dec 19, 10:25 am, Michael Torrie torr...@gmail.com wrote: Personally the new string formatter is sorely needed in Python.   Really? You know, it's funny, but when I

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread r
On Dec 20, 5:27 pm, walterbyrd walterb...@iname.com wrote: On Dec 19, 10:25 am, Michael Torrie torr...@gmail.com wrote: Personally the new string formatter is sorely needed in Python.   Really? You know, it's funny, but when I read problems that people have with python, I don't remember

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread MRAB
r wrote: Walter, Would you be kind enough to translate this code to the new syntax? s = 'python' n = 12 f = 1.3 '%s %05d %0.2f' %(s,n,f) 'python 00012 1.33' i want to see how casting is handled. Thanks '{0} {1:05} {2:.2}'.format(s, n, f) 'python 00012 1.3' --

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread r
On Dec 20, 6:05 pm, Roy Smith r...@panix.com wrote: In article b58f588a-e8db-41df-a488-f7df62d56...@w39g2000prb.googlegroups.com,  walterbyrd walterb...@iname.com wrote: On Dec 19, 10:25 am, Michael Torrie torr...@gmail.com wrote: Personally the new string formatter is sorely needed in

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread r
Thanks MRAB, except the float is not 2 decimal places, but its there Come on... They did this for the interpreter not us. It's easer to parse this string with positional arguments and a dict of format descriptions. Come on pydev, at least be honest about it! --

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread bearophileHUGS
walterbyrd: As I understand it, that may have been true at one time. But, Ruby 1.9 very significantly sped up the language. While Python has been made slower, Ruby has been made much faster. I have already answered regarding Python3 in this thread. Regarding Ruby you are right, in computer

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Roy Smith
In article 6b4176c3-49ce-4e7c-bced-07d8d19bc...@s20g2000yqh.googlegroups.com, r rt8...@gmail.com wrote: You can't just blindly Parrot off.. well CPU's get faster every year. Sure you can :-) There was a nice treatment of this on slashdot today

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread MRAB
r wrote: Thanks MRAB, except the float is not 2 decimal places, but its there Oops! '{0} {1:05} {2:.2f}'.format(s, n, f) 'python 00012 1.33' '{0:s} {1:05d} {2:.2f}'.format(s, n, f) 'python 00012 1.33' -- http://mail.python.org/mailman/listinfo/python-list

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Steven D'Aprano
On Sat, 20 Dec 2008 16:20:38 -0800, r wrote: On Dec 20, 6:05 pm, Roy Smith r...@panix.com wrote: I had an interesting experience with this recently.  I was giving a co-worker quick python into.  He's an experienced programer in various languages, but this was his first exposure to python.

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Steven D'Aprano
On Sat, 20 Dec 2008 15:27:43 -0800, walterbyrd wrote: On Dec 19, 10:25 am, Michael Torrie torr...@gmail.com wrote: Personally the new string formatter is sorely needed in Python. Really? You know, it's funny, but when I read problems that people have with python, I don't remember seeing

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread r
On Dec 20, 7:38 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sat, 20 Dec 2008 16:20:38 -0800, r wrote: On Dec 20, 6:05 pm, Roy Smith r...@panix.com wrote: I had an interesting experience with this recently.  I was giving a co-worker quick python into.  He's an

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Aaron Brady
On Dec 20, 7:38 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Instead of just whinging, how about making a suggestion to fix it? Go on, sit down for an hour or ten and try to work out how a BINARY OPERATOR like % (that means it can only take TWO arguments) can deal with an

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Steven D'Aprano
On Sat, 20 Dec 2008 16:01:58 -0800, r wrote: Just to be on record, i am OK with adding a new way to do this as long as the old C style str format does not ever go away. I don't like 20 ways to do the same thing, but i really like the compact way of %formating now. % formatting isn't compact

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Steven D'Aprano
On Sat, 20 Dec 2008 17:54:09 -0800, r wrote: Would you like to elaborate on -why- escaped backslashes are needed in strings... i waiting??? If you can't escape backslashes in strings, how do you create a string containing a backslash? -- Steven --

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread MRAB
bearophileh...@lycos.com wrote: walterbyrd: As I understand it, that may have been true at one time. But, Ruby 1.9 very significantly sped up the language. While Python has been made slower, Ruby has been made much faster. I have already answered regarding Python3 in this thread. Regarding

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread r
Answering a question with a question, that leaves me with a question of my own?? Instead of just whinging, how about making a suggestion to fix it? Go on, sit down for an hour or ten and try to work out how a BINARY OPERATOR like % (that means it can only take TWO arguments) can deal with an

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Steven D'Aprano
On Sat, 20 Dec 2008 17:55:35 -0800, Aaron Brady wrote: On Dec 20, 7:38 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Instead of just whinging, how about making a suggestion to fix it? Go on, sit down for an hour or ten and try to work out how a BINARY OPERATOR like % (that

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread MRAB
Aaron Brady wrote: On Dec 20, 7:38 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Instead of just whinging, how about making a suggestion to fix it? Go on, sit down for an hour or ten and try to work out how a BINARY OPERATOR like % (that means it can only take TWO arguments)

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Steven D'Aprano
On Sat, 20 Dec 2008 18:23:00 -0800, r wrote: Answering a question with a question, that leaves me with a question of my own?? Instead of just whinging, how about making a suggestion to fix it? Go on, sit down for an hour or ten and try to work out how a BINARY OPERATOR like % (that means

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread walterbyrd
On Dec 20, 5:05 pm, Roy Smith r...@panix.com He got really hung up on the % syntax. I guess it's good to know that there is, at least, one person in the world doesn't like the % formatting. As least the move was not entirely pointless. But, you must admit, of all the things people complain

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Kay Schluehr
On 20 Dez., 02:54, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Debated by who? The entire Python-using community? Every single Python programmer? Or just the small proportion of Python developers who are also core developers? If I'd asked people what they wanted, they would

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread r
On Dec 20, 11:11 pm, walterbyrd walterb...@iname.com wrote: On Dec 20, 5:05 pm, Roy Smith r...@panix.com He got really hung up on the % syntax. I guess it's good to know that there is, at least, one person in the world doesn't like the % formatting. As least the move was not entirely

New Python 3.0 string formatting - really necessary?

2008-12-19 Thread walterbyrd
I have not worked with Python enough to really know. But, it seems to me that more I look at python 3.0, the more I wonder if it isn't a step backwards. To me, it seems that this: print %s=%d % ('this',99) Is much easier, and faster, to type, and is also easier to read and understand. It also

Re: New Python 3.0 string formatting - really necessary?

2008-12-19 Thread Giampaolo Rodola'
On 19 Dic, 17:01, walterbyrd walterb...@iname.com wrote: I have not worked with Python enough to really know. But, it seems to me that more I look at python 3.0, the more I wonder if it isn't a step backwards. To me, it seems that this: print %s=%d % ('this',99) Is much easier, and

Re: New Python 3.0 string formatting - really necessary?

2008-12-19 Thread r
if 3.0 looks like... print( {0}={1}.format('this',99)) , WTF... thats retarded and looks like Ruby code. Thats not intuitive thats madness! What happens when you need a conversion to string from an integer, more code?? My faith is slipping. Have the python Gods gone mad??. Please tell me i am

Re: New Python 3.0 string formatting - really necessary?

2008-12-19 Thread walterbyrd
On Dec 19, 9:13 am, Giampaolo Rodola' gne...@gmail.com wrote: You can use the old 2.x syntax also in Python 3.x: Yeah, but it's deprecated, and - as I understand it - may be removed completely in future versions. Also, in the future, if you are working with code from another developer, it's

Re: New Python 3.0 string formatting - really necessary?

2008-12-19 Thread Michael Torrie
r wrote: if 3.0 looks like... print( {0}={1}.format('this',99)) , WTF... thats retarded and looks like Ruby code. Thats not intuitive thats madness! What happens when you need a conversion to string from an integer, more code?? My faith is slipping. Have the python Gods gone mad??. Please

  1   2   >