Is this a bug?

Alex Martelli aleaxit at yahoo.com
Sat May 12 11:44:07 EDT 2001


"Costas Menico" <costas at meezon.com> wrote in message
news:3afd33ac.3862765 at News.CIS.DFN.DE...
    [snip]
> To me the r'' syntax is inconsistent and works 99% of the time only.
> I don't want to check if there is a BS at the end of a string and do
> some magic to fix it. The r'' should be doing that for me.

How would your dream r-architecture magically let you write
    x=r'ba\'    # hypothetical rawstring with a trailing BS
AND
    y=r'ba\'    # hypothetical rawstring with a trailing BS'
where y is meant to contain a backslash-quote combination
and then the whitespace, the hash, etc?


> I just don't understand why the parser can't be smart enough about
> this.

Maybe some unlimited reams of lookahead might let a parsed
be 'smart' enough to disambiguate -- and maybe not, but I'm
sure I don't want to be using a language which exhibits FAR TOO
MUCH "black magic" trying to make things "convenient" for me,
and having the meaning of \' depend on what comes a zillion
characters afterwards (in what looks like a comment... and IS
a comment if \' is string-end...) is well within the 'far too much'
range for my personal tastes.


Alex






More information about the Python-list mailing list