Unrecognized escape sequences in string literals
Douglas Alan
darkwater42 at gmail.com
Wed Aug 12 13:23:50 EDT 2009
On Aug 12, 3:08 am, Steven D'Aprano
<ste... at REMOVE.THIS.cybersource.com.au> wrote:
> On Tue, 11 Aug 2009 14:48:24 -0700, Douglas Alan wrote:
> > In any case, my argument has consistently been that Python should have
> > treated undefined escape sequences consistently as fatal errors,
>
> A reasonable position to take. I disagree with it, but it is certainly
> reasonable.
>
> > not as warnings.
>
> I don't know what language you're talking about here, because non-special
> escape sequences in Python aren't either errors or warnings:
>
> >>> print "ab\cd"
>
> ab\cd
I was talking about C++, whose compilers tend to generate warnings for
this usage. I think that the C++ compilers I've used take the right
approach, only ideally they should be *even* more emphatic, and
elevate the problem from a warning to an error.
I assume, however, that the warning is a middle ground between doing
the completely right thing, and, I assume, maintaining backward
compatibility with common C implementations. As Python never had to
worry about backward compatibility with C, Python didn't have to walk
such a middle ground.
On the other hand, *now* it has to worry about backward compatibility
with itself.
|>ouglas
More information about the Python-list
mailing list