[Python-Dev] Re: string repr in 2.1 (fwd) (original) (raw)

Thomas Wouters thomas@xs4all.net
Tue, 29 May 2001 11:52:01 +0200


Robin apparently ran into a real problem caused by the change in string repr() semantics. Now, arguably this is his own stupid fault (and indeed he argues that himself) but that doesn't mean we shouldn't take this into account. We could, for instance, revert 2.1.1 to the old behaviour, giving at least someone a reason to switch to 2.1.1 ;) Or we could decide what the string repr() change really wanted was just for the REPL to print it like this, in which case the displayhook should fix it, not string_repr.

Opinions ? Ping, IIRC, this was your proposal, so yours would be especially valuable ;)

----- Forwarded message from Robin Becker <robin@jessikat.fsnet.co.uk> -----

Date: Tue, 29 May 2001 09:58:49 +0100 From: Robin Becker <robin@jessikat.fsnet.co.uk> To: Thomas Wouters <thomas@xs4all.net> Cc: python-list@python.org Subject: Re: string repr in 2.1

In message <20010529102414.P690@xs4all.nl>, Thomas Wouters <thomas@xs4all.net> writes

On Tue, May 29, 2001 at 12:47:39AM +0100, Robin Becker wrote:

In article <slrn9h5m4o.1hk.scarblac@pino.selwerd.nl>, Remco Gerlich <scarblac@pino.selwerd.nl> writes

>Since 2.1, string repr uses heximal escapes instead of octal ones. yes I guess all those *nix tools that like octal should be whipped and made to obey the malevolent dictator. Do you have tools you use to parse quoted (repr'd) Python strings that handle octal correctly, but don't handle \x and \n\r escape codes ? Which ones ? And were you aware that they were going to break sooner or later, just because someone can prefer 'readable' escape codes and feed it that instead ? :) Yes I have such tools. One is called Acrobat Reader, another is traditional sed and awk. My dos grep doesn't seem to like hex, I suppose I must update it and all other tools.

My C compiler understands octal and the newer ones do hex as well.

I can read octal and do arithmetic in it probably easier than hex. I don't defend the octal representation it's just very widespread in the older tools. Our usage of repr was probably stupid as clearly repr can change.

How I long for my 18-bit PDP-15 :) what happened to my 15 octal digit cdc! Oh woe is me! Where are the duo-decimal calculators of yore?

Robin Becker

----- End forwarded message -----

-- Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!