Substitution with Hash Values

Jeff Shannon jeff at ccvcorp.com
Mon Apr 22 14:28:10 EDT 2002


In article <slrnac326d.gba.jon+usenet at snowy.squish.net>, 
jon+usenet at unequivocal.co.uk says...
> In article <mailman.1019315200.29890.python-list at python.org>,
>   holger krekel wrote:

> > But is it true that you 'never' use them somewhere else? 
> > I would think that one would like to use 'r' whenever you don't 
> > want the escape-sequence-string-interpretation which is not really
> > restricted to regexp-strings. 
> 
> True, but personally I've never found any other use for them.

Then you probably use a unixoid OS.  ;)  Since Windows uses \ as 
a path separator, any Windows path strings tend to have lots of 
\'s in them, and are thus good candidates for using raw strings.

Holger is correct -- they are useful anywhere you don't want the 
escape-sequence interpretation done.  But \'s aren't terribly 
common except in regexes and Windows paths, so those are the main 
places that raw strings get used.

-- 

Jeff Shannon
Technician/Programmer
Credit International



More information about the Python-list mailing list