Re: string goes away

2005-04-04 Thread John J. Lee
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: [...] > Of course that statement is also false. Performance prediction is very > difficult, and you cannot imply much from this benchmark. In other [...] s/imply/infer/ John -- http://mail.python.org/mailman/listinfo/python-list

Re: string goes away

2005-04-04 Thread Duncan Booth
John J. Lee wrote: > Duncan Booth <[EMAIL PROTECTED]> writes: > [...] >>str.join(sep, list_of_str) > [...] > > Doesn't work with unicode, IIRC. > > str.join won't work if sep is unicode, but generally you know what type the separator is and str.join will quite happily join a list of string

Re: string goes away

2005-04-03 Thread Greg Ewing
Dan Bishop wrote: John J. Lee wrote: Doesn't work with unicode, IIRC. u" ".join(["What's", "the", "problem?"]) u"What's the problem?" str.join(x, y) isn't quite a drop-in replacement for string.join(y, x), since it's not polymorphic on the joining string: >>> str.join(u" ", ["a", "b"]) Traceback (

Re: string goes away

2005-04-03 Thread Dan Bishop
John J. Lee wrote: > Duncan Booth <[EMAIL PROTECTED]> writes: > [...] > >str.join(sep, list_of_str) > [...] > > Doesn't work with unicode, IIRC. >>> u" ".join(["What's", "the", "problem?"]) u"What's the problem?" -- http://mail.python.org/mailman/listinfo/python-list

Re: string goes away

2005-04-03 Thread Paul Rubin
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Out of curiosity: when thinking about Python 3.0, what is the timespan > in which you expect that to appear? Before 2010? After 2010? After 2020? I'm not terribly worried about Python 3.0 incompatibilities, whenever those are. There are already thre

Re: string goes away

2005-04-03 Thread "Martin v. Löwis"
Andreas Beyer wrote: If I am getting the docs etc. correctly, the string-module is depricated and is supposed to be removed with the release of Python 3.0. I still use the module a lot and there are situations in which I don't know what to do without it. Maybe you can give me some help. Out of cu

Re: string goes away

2005-04-03 Thread "Martin v. Löwis"
Andreas Beyer wrote: Yeeh, I was expecting something like that. The only reason to use map() at all is for improving the performance. That is lost when using list comprehensions (as far as I know). So, this is *no* option for larger jobs. Don't believe anything you hear right away, especially not

Re: string goes away

2005-04-03 Thread John J. Lee
Duncan Booth <[EMAIL PROTECTED]> writes: [...] >str.join(sep, list_of_str) [...] Doesn't work with unicode, IIRC. John -- http://mail.python.org/mailman/listinfo/python-list

Re: string goes away

2005-04-02 Thread Mike Meyer
Andreas Beyer <[EMAIL PROTECTED]> writes: > OK, you won. I read in an (regretably old) guidline for improving > Python's performance that you should prefer map() compared to list > comprehensions. Apparently the performance of list comprehensions has > improved a lot, which is great. (Or the overh

Who said that? (was Re: string goes away)

2005-04-01 Thread Peter Hansen
Ivan Van Laningham wrote: Tim Peters sayeth, "Premature Optimization is the Root of All Evil." And he is not kidding. And just to forestall another long thread about who actually said that originally, it was really Mark Twain, quoting Churchill. Tim just added a . -Peter -- http://mail.python.org

Re: string goes away

2005-04-01 Thread Ivan Van Laningham
Hi All-- Michael Chermside wrote: > > The REAL lesson here is that you shouldn't follow any "optimization" > rules without actually testing them. If you don't have time to test, > then just don't optimize... write whatever is most readable. If you > NEED more speed, then profiling and testing wil

string goes away

2005-04-01 Thread Michael Chermside
Andreas Beyer writes: > Yeeh, I was expecting something like that. The only reason to > use map() at all is for improving the performance. That is > lost when using list comprehensions (as far as I know). So, > this is *no* option for larger jobs. Skip Montanaro replied: > Did you test your hypot

Re: string goes away

2005-04-01 Thread Andreas Beyer
OK, you won. I read in an (regretably old) guidline for improving Python's performance that you should prefer map() compared to list comprehensions. Apparently the performance of list comprehensions has improved a lot, which is great. (Or the overhead of calling map() got too big, but I hope th

Re: string goes away

2005-04-01 Thread Duncan Booth
Andreas Beyer wrote: > I loved to use > >>> string.join(list_of_str, sep) > instead of > >>> sep.join(list_of_str) > > I think the former is much more telling what is happening than the > latter. However, I will get used to it. No need to get used to it. Just reverse the order of the arguments

Re: string goes away

2005-03-31 Thread Jack Diederich
On Thu, Mar 31, 2005 at 08:32:20PM -0800, Andreas Beyer wrote: > Hi: > > If I am getting the docs etc. correctly, the string-module is depricated > and is supposed to be removed with the release of Python 3.0. > I still use the module a lot and there are situations in which I don't > know what t

Re: string goes away

2005-03-31 Thread Dan Christensen
"Delaney, Timothy C (Timothy)" <[EMAIL PROTECTED]> writes: > Andreas Beyer wrote: > >> Yeeh, I was expecting something like that. The only reason to use >> map() at all is for improving the performance. >> That is lost when using list comprehensions (as far as I know). So, >> this is *no* option f

Re: string goes away

2005-03-31 Thread Skip Montanaro
Andreas> Yeeh, I was expecting something like that. The only reason to Andreas> use map() at all is for improving the performance. That is Andreas> lost when using list comprehensions (as far as I know). So, Andreas> this is *no* option for larger jobs. Did you test your hypothes

Re: string goes away

2005-03-31 Thread alex23
Hey Andreas, > I loved to use > >>> string.join(list_of_str, sep) > instead of > >>> sep.join(list_of_str) > > I think the former is much more telling what is happening than the > latter. However, I will get used to it. I find that binding a name to the separator makes it more readable (YMMV):

RE: string goes away

2005-03-31 Thread Delaney, Timothy C (Timothy)
Andreas Beyer wrote: > Yeeh, I was expecting something like that. The only reason to use > map() at all is for improving the performance. > That is lost when using list comprehensions (as far as I know). So, > this is *no* option for larger jobs. Try it and see. You'll probably be pleasantly surp

Re: string goes away

2005-03-31 Thread Ivan Van Laningham
Hi All-- Andreas Beyer wrote: > > I loved to use > >>> string.join(list_of_str, sep) > instead of > >>> sep.join(list_of_str) > > I think the former is much more telling what is happening than the > latter. However, I will get used to it. > I disagree, but maybe you could think of it as a mu

Re: string goes away

2005-03-31 Thread Andreas Beyer
Yeeh, I was expecting something like that. The only reason to use map() at all is for improving the performance. That is lost when using list comprehensions (as far as I know). So, this is *no* option for larger jobs. Andreas Skip Montanaro wrote: >>> upper_list = map(string.upper, list_of_st

Re: string goes away

2005-03-31 Thread Skip Montanaro
>>> upper_list = map(string.upper, list_of_str) Andreas> What am I supposed to do instead? Try [s.upper() for s in list_of_str] Skip -- http://mail.python.org/mailman/listinfo/python-list

string goes away

2005-03-31 Thread Andreas Beyer
Hi: If I am getting the docs etc. correctly, the string-module is depricated and is supposed to be removed with the release of Python 3.0. I still use the module a lot and there are situations in which I don't know what to do without it. Maybe you can give me some help. I loved to use >>> string