Unrecognized escape sequences in string literals

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Aug 12 19:19:20 EDT 2009


On Wed, 12 Aug 2009 14:21:34 -0700, Douglas Alan wrote:

> On Aug 12, 5:32 am, Steven D'Aprano
> <ste... at REMOVE.THIS.cybersource.com.au> wrote:
> 
>> That problem basically boils down to a deep-seated philosophical
>> disagreement over which philosophy a language should follow in regard
>> to backslash escapes:
>>
>> "Anything not explicitly permitted is forbidden"
>>
>> versus
>>
>> "Anything not explicitly forbidden is permitted"
> 
> No, it doesn't. It boils down to whether a language should:
> 
> (1) Try it's best to detect errors as early as possible, especially when
> the cost of doing so is low.

You are making an unjustified assumption: \y is not an error. It is only 
an error if you think that anything not explicitly permitted is forbidden.

While I'm amused that you've made my own point for me, I'm less amused 
that you seem to be totally incapable of seeing past your parochial 
language assumptions, even when those assumptions are explicitly pointed 
out to you. Am I wasting my time engaging you in discussion? 

There's a lot more I could say, but time is short, so let me just 
summarise:

I disagree with nearly everything you say in this post. I think that a 
few points you make have some validity, but the vast majority are based 
on a superficial and confused understanding of language design 
principles. (I won't justify that claim now, perhaps later, time 
permitting.) Nevertheless, I think that your ultimate wish -- for \y etc 
to be considered an error -- is a reasonable design choice, given your 
assumptions. But it's not the only reasonable design choice, and Bash has 
made a different choice, and Python has made yet a third reasonable 
choice, and Pascal made yet a fourth reasonable choice.

These are all reasonable choices, all have some good points and some bad 
points, but ultimately the differences between them are mostly arbitrary 
personal preference, like the colour of a car. Disagreements over 
preferences I can live with. One party insisting that red is the only 
logical colour for a car, and that anybody who prefers white or black or 
blue is illogical, is unacceptable.



-- 
Steven



More information about the Python-list mailing list