[Patches] [ python-Patches-727789 ] Editing of __str__ and __repr__
docs
SourceForge.net
noreply at sourceforge.net
Tue Sep 2 14:17:57 EDT 2003
Patches item #727789, was opened at 2003-04-25 16:25
Message generated for change (Settings changed) made by staschuk
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: Closed
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: Steven Taschuk (staschuk)
Date: 2003-09-02 14:17
Message:
Logged In: YES
user_id=666873
I'll close it; I have no revision coming. Someone more motivated
than I am can take the discussion to c.l.py if desired.
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2003-08-26 23:15
Message:
Logged In: YES
user_id=80475
Can we close this patch or is a revision forthcoming?
----------------------------------------------------------------------
Comment By: Raymond Hettinger (rhettinger)
Date: 2003-07-08 19:07
Message:
Logged In: YES
user_id=80475
Consider taking this back to the newsgroup to tease out
some wording that everyone finds more palatable. The
verbiage should be terse, factual, and general without being
overly abstract or preachy.
The most recent suggestion (below) is not one I would
approve. The circularity and indirectness make the docs
unhelpful, hard to read, and uninformative.
Brett's suggestion is close to the mark.
----------------------------------------------------------------------
Comment By: Donn Cave (donnc)
Date: 2003-07-08 18: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-08 18: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-28 22: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
More information about the Patches
mailing list