String handling bug in Python

Bjorn Pettersen BPettersen at NAREX.com
Fri Apr 26 18:35:18 EDT 2002


> From: Tim Peters [mailto:tim.one at comcast.net] 
> > I would think that would occur less frequently than \ at 
> the end of a 
> > string though (especially with windows path names).  I feel 
> I must be 
> > missing something?
> 
> The good news is that I also feel that you are <wink>.  

Well, I'm glad we're in agreement <wink>

> r-strings were primarily intended to ease writing regular 
> expressions (which can never end with an odd number of 
> backslashes), and people using \ in Windows pathnames are 
> usually missing an obvious alternative (like the forward 
> slash -- Windows API functions couldn't care less which kind 
> of slash you use; and portable code should avoid any literal 
> slashes via os.path.join()).

It seems a shame to limit such a potentially useful feature to only one
domain.

Believe me, I get your windows comment, but when you work in a purely
windows shop what "should" be done to make code portable doesn't fly
unless it's also shorter, easier, and makes the code faster <wink>.

At-least-they-provide-us-with-free-beer'ly y'rs
-- bjorn





More information about the Python-list mailing list