[Python-3000] Removing repr
Robey Pointer
robey at lag.net
Thu Apr 6 21:15:15 CEST 2006
On 6 Apr 2006, at 7:02, John J Lee wrote:
> On Thu, 6 Apr 2006, Michael P. Soulier wrote:
> [...]
>> I thought that the distinction was as follows.
>>
>> str() should return a human-readable representation of something.
>>
>> repr() should return a machine-readable representation of
>> something, suitable
>> for an exec command.
> [...]
>
> Is this old chestnut really still around? repr() is for debugging; it
> does not have to return an eval()-able string. The __repr__ docs
> explain
> that well.
Yes, I find this to be one of the advantages python has over java: In
python, coercion to string (str) is separate from providing a
description for debugging (repr).
Until your email, I was starting to think I was unusual in this
interpretation.
robey
More information about the Python-3000
mailing list