[Python-ideas] automation of __repr__/__str__ for all the common simple cases

Nick Coghlan ncoghlan at gmail.com
Thu Feb 16 08:04:11 CET 2012


On Thu, Feb 16, 2012 at 4:24 PM, Serhiy Storchaka <storchaka at gmail.com> wrote:
> 16.02.12 02:03, Nick Coghlan написав(ла):
>
>> The unfortunate part of dict-based __repr__ implementations is that
>> the order of the parameter display is technically arbitrary.
>
>
> Not for OrderedDict.

Yes, but relying on OrderedDict rules out using keyword arguments to
make any API easier to use. At that point, it's generally simpler for
people to write their own repr that does exactly what they want.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-ideas mailing list