Re: repr question

Jaap Vermeulen (jaap@sequent.com)
Mon, 25 Jul 94 22:40:41 GMT

In <199407202233.PAA00446@infoseek.com> Jim Roskind <jar@infoseek.com> writes:

>> From: monty@tbyte.com (Monty)
...
>> To be able to create the object from it's repr implies that instead of
>> "import complex" you need to do "from complex import *". Is that pretty
>> much standard practice, or would it make sense for repr to reference it's
>> module?
...
>In general, it should be the case (IMHO) that exec'ing the repr string
>should create an instance of something that (at a minimum) compares
>equal with the original. The first example requires that the
...

I think that repr() was not necessarily designed for recreating
objects. Although it does so for certain simple built-in objects, it
doesn't work for a whole slew of other objects (e.g.: sockets, files).

To use a single function for both readability and recreatability (this
must be a new word... :-) is impossible. I would settle for a function
that prints a readable description of the object (a la Smalltalk
'printString'), and a function that prints a recreatable description of
the object (a la Smalltalk 'storeString').

$0.02

-Jaap-

-- 
Jaap Vermeulen					+--------------------------+
						| Sequent Computer Systems |
	Internet : jaap@sequent.com		| Beaverton, Oregon	   |
	Uucp	 : ...uunet!sequent!jaap	+--------------------------+