[merge] doc: coding standards for repr methods

Andrew Bennetts andrew at canonical.com
Wed May 28 02:44:58 BST 2008


Martin Pool wrote:
> On Wed, May 28, 2008 at 9:50 AM, Michael Hudson
> <michael.hudson at canonical.com> wrote:
> > Martin Pool wrote:
> >>
> >> Patch says it all, I think.  I have been doing this in some places and
> >> think it is very useful.
> >
> > Do you think it's worth adding something about how the strings returned by
> > __repr__ shouldn't be more than a couple of hundred bytes long, if you agree
> > with me that this is a good idea?  I've had some irritating experiences
> > lately with repr strings that are a few kb long...
> 
> I don't know if I'd require an absolute guarantee it will never be
> long but it's a good thing to continue.  I'll do it as a tweak if a
> core dev will approve it.

Well, as it already says, “They're to be read by humans”.  So I'm fine with it
explicitly saying they should typically be no more than a couple of hundred
bytes long.

The only time I've ever really had this problem in bzrlib is with the repr of
trees or inventories, IIRC.

-Andrew.




More information about the bazaar mailing list