Re: Iteration over strings

2007-08-01 Thread Stefan Behnel
> Robert Dailey wrote: >> I have the following code: >> >> str = "C:/somepath/folder/file.txt" >> >> for char in str: >> if char == "\\": >> char = "/" >> >> The above doesn't modify the variable 'str' directly. I'm still pretty new >> to Python so if someone could explain to me why thi

Re: Iteration over strings

2007-08-01 Thread Duncan Booth
Jay Loden <[EMAIL PROTECTED]> wrote: > This isn't just a problem with the socket module, so please don't > think I'm picking on it or singling it out, it's something I've seen a > number of places. e.g. from os.stat: > > os.stat = stat(...) > stat(path) -> stat result > > Perform a

Re: Finding documentation (WAS: Iteration over strings)

2007-07-31 Thread Steve Holden
Jay Loden wrote: > Steve Holden wrote: >> In this particular case the documentation is quite explicit about the >> return value and the documentation for the function runs to almost 400 >> words. Do you expect *everything* to be in the source? That isn't >> practical, as documenting everything t

Re: Finding documentation (WAS: Iteration over strings)

2007-07-31 Thread Jay Loden
Steve Holden wrote: > In this particular case the documentation is quite explicit about the > return value and the documentation for the function runs to almost 400 > words. Do you expect *everything* to be in the source? That isn't > practical, as documenting everything twice like that makes tw

Re: Iteration over strings

2007-07-31 Thread Steve Holden
Jay Loden wrote: [...] > This isn't just a problem with the socket module, so please don't think I'm > picking on it or singling it out, it's something I've seen a number of > places. e.g. from os.stat: > > os.stat = stat(...) > stat(path) -> stat result > > Perform a stat system c

Re: Iteration over strings

2007-07-31 Thread Jerry Hill
On 7/31/07, Jay Loden <[EMAIL PROTECTED]> wrote: > This isn't just a problem with the socket module, so please don't think I'm > picking on it or singling it out, it's something I've seen a number of > places. e.g. from os.stat: You picked out two specific examples as being bad, so I thought I'd

Re: Iteration over strings

2007-07-31 Thread Hexamorph
Jay Loden schrieb: > Well, I don't want to start a flamewar or anything like that Nothing like that intended here either :) OTOH, on most forums, lists, boards, etc, I am active, the constant fear about "flamewars" annoys me somewhat. As long as it doesn't get insulting, derogative or bull-hea

Re: Iteration over strings

2007-07-31 Thread Jay Loden
Hexamorph wrote: > Hexamorph schrieb: >> Jay Loden schrieb: >>> I have to agree with you WRT to the Python documentation, it does tend >>> to be lacking and difficult to find things at times. > > Hmm, I find the Python documentation just excellent. You are > searching for a *string* related prob

Re: Iteration over strings

2007-07-31 Thread Hexamorph
Hexamorph schrieb: > Jay Loden schrieb: >> >> I have to agree with you WRT to the Python documentation, it does tend >> to be lacking and difficult to find things at times. Hmm, I find the Python documentation just excellent. You are searching for a *string* related problem? Then just check the

Re: Iteration over strings

2007-07-31 Thread Hexamorph
Jay Loden schrieb: > > I have to agree with you WRT to the Python documentation, it does tend to be > lacking and difficult to find things at times. In this case the two ways I > can think of to look for something like this would have been: Hmm, I find the Python documentation just excellent.

Re: Iteration over strings

2007-07-31 Thread Jay Loden
Robert Dailey wrote: > Hey, > > Thanks a lot for your answers guys. I had already known that strings are > immutable, but having been a C++ programmer for years I'm still trying to > get over the fact that it's not std::string :) The python documentation > isn't that easy to navigate in my opinion

Re: Iteration over strings

2007-07-31 Thread Robert Dailey
Hey, Thanks a lot for your answers guys. I had already known that strings are immutable, but having been a C++ programmer for years I'm still trying to get over the fact that it's not std::string :) The python documentation isn't that easy to navigate in my opinion, so I wasn't able to find the 'r

Re: Iteration over strings

2007-07-31 Thread Hexamorph
Jay Loden schrieb: > Robert Dailey wrote: >> str = "C:/somepath/folder/file.txt" >> >> for char in str: >> if char == "\\": >> char = "/" > strings in Python are immutable - in other words, they cannot be updated in > place as you're doing above. However, that doesn't mean you can't a

Re: Iteration over strings

2007-07-31 Thread Brett g Porter
Robert Dailey wrote: > Hi, > > I have the following code: > > str = "C:/somepath/folder/file.txt" > > for char in str: > if char == "\\": > char = "/" > > The above doesn't modify the variable 'str' directly. I'm still pretty > new to Python so if someone could explain to me why th

Re: Iteration over strings

2007-07-31 Thread Jay Loden
Robert Dailey wrote: > Hi, > > I have the following code: > > str = "C:/somepath/folder/file.txt" > > for char in str: > if char == "\\": > char = "/" > > The above doesn't modify the variable 'str' directly. I'm still pretty new > to Python so if someone could explain to me why thi

Iteration over strings

2007-07-31 Thread Robert Dailey
Hi, I have the following code: str = "C:/somepath/folder/file.txt" for char in str: if char == "\\": char = "/" The above doesn't modify the variable 'str' directly. I'm still pretty new to Python so if someone could explain to me why this isn't working and what I can do to achieve