[PYTHON MATRIX-SIG] repr vs. str

Perry A. Stoll pas@lems.brown.edu
Mon, 19 Aug 1996 15:51:57 -0400 (EDT)



Currently the str and repr functions call the same function
to print an array object, namely string_repr.  From the manual 
http://www.python.org/doc/ref/node23.html#SECTION00431000000000000000

__repr__(self) 
     Called by the repr() built-in function and by string conversions 
(reverse or backward quotes) to compute the string
     representation of an object.                

__str__(self) 
     Called by the str() built-in function and by the print statement 
compute the string representation of an object.       


Seems like print and str should return the same string, which in this 
case would be whatever the array print function is.  I thought repr 
should try to return a string which could be used to reconstruct the 
object and str was purely for human consumption. Is that correct?



-Perry
 <pas@lems.brown.edu>


=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================