Unrecognized escape sequences in string literals

Douglas Alan darkwater42 at gmail.com
Sat Aug 15 20:57:28 EDT 2009


On Aug 14, 1:55 pm, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:

> Douglas, you and I clearly have a difference of opinion on
> this. Neither of us have provided even the tiniest amount
> of objective, replicable, reliable data on the
> error-proneness of the C++ approach versus that of
> Python. The supposed superiority of the C++ approach is
> entirely subjective and based on personal opinion instead
> of quantitative facts.

Alas, this is true for nearly any engineering methodology or
philosophy, which is why, I suppose, Perl, for instance,
still has its proponents. It's virtually impossible to prove
any thesis, and these things only get decided by endless
debate that rages across decades.

> I prefer languages that permit anything that isn't
> explicitly forbidden, so I'm happy that Python treats
> non-special escape sequences as valid,

I don't really understand what you mean by this. If Python
were to declare that "unrecognized escape sequences" were
forbidden, then they would be "explicitly forbidden". Would
you then be happy?

If not, why are you not upset that Python won't let me do

   [3, 4, 5] + 2

Some other programming languages I've used certainly do.

> and your attempts to convince me that this goes against
> the Zen have entirely failed to convince me. As I've done
> before, I will admit that one consequence of this design
> is that it makes it hard to introduce new escape sequences
> to Python. Given that it's vanishingly rare to want to do
> so,

I'm not so convinced of that in the days of Unicode. If I
see, backslash, and then some Kanji character, what am I
supposed to make of that? For all I know, that Kanji
character might mean newline, and I'm seeing code for a
version of Python that was tweaked to be friendly to the
Japanese. And in the days where smart hand-held devices are
proliferating like crazy, there might be ever-more demand
for easy-to-use i/o that lets you control various aspects of
those devices.

|>ouglas



More information about the Python-list mailing list