[Patches] [ python-Patches-727789 ] Editing of __str__ and __repr__ docs

SourceForge.net noreply@sourceforge.net
Tue, 08 Jul 2003 17:04:55 -0700


Patches item #727789, was opened at 2003-04-25 22:25
Message generated for change (Comment added) made by donnc
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=727789&group_id=5470

Category: Documentation
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Steven Taschuk (staschuk)
Assigned to: Nobody/Anonymous (nobody)
Summary: Editing of __str__ and __repr__ docs

Initial Comment:
A recent thread in comp.lang.python [1] suggests that
there is some question whether the existing docs for
the __str__ and __repr__ methods is clear, and whether
what it says is good in the first place.

The patch shows proposed changes based on the
discussions in that thread.  The new text treats __repr__
as a programmer-centric stringification (with eval(repr(x))
== x as a possibility, rather than a principle), and __str__
as a more general-purpose stringification-as-appropriate-
to-the-object.

[1] http://groups.google.com/groups?th=24b817d49ec3a59b

----------------------------------------------------------------------

Comment By: Donn Cave (donnc)
Date: 2003-07-09 00:04

Message:
Logged In: YES 
user_id=42839

In __str__, I would replace the whole commentary paragraph 
with  "This string value is the result of converting the object 
data to string type, for use in applications that require a 
string and don't care about the original object per se."

----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2003-05-09 00:20

Message:
Logged In: YES 
user_id=357491

I agree with Raymond that it seems "wordy".  For instance, the first changed 
paragraph is basically just trying to say "__repr__ should return something 
that can be past to 'eval' to return return the same object.  If this is not 
possible then make its output useful to the programmer."  Don't need to go 
on about it needing to be a "valid Python expression" and such.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2003-04-29 04:52

Message:
Logged In: YES 
user_id=80475

The patch looks technically correct.  It is wordy and I liked 
the original better, but clarity is more important.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=727789&group_id=5470