[Python-Dev] Re: PEP 218 (sets); moving set.py to Lib

Aahz aahz@pythoncraft.com
Sat, 17 Aug 2002 19:49:45 -0400

On Sat, Aug 17, 2002, François Pinard wrote:
> [Guido van Rossum]
>> - The set constructors have an optional second argument, sort_repr,
>>   defaulting to False, which decides whether the elements are sorted
>>   when str() or repr() is taken.  I'm not sure if there would be
>>   negative consequences of removing this argument and always sorting
>>   the string representation.
> Unless there is something deep attached to the properties of the sets
> themselves, I do not understand why the sorting/non-sorting virtues of
> `repr' should be tied with the constructor.
> There is a precedent with dicts.  They print non-sorted, but they
> pretty-print (through the `pprint' module) sorted.  Maybe the same could
> be done for sets: use `pprint' if you want a sorted representation.
> But otherwise, sets as well as dicts should print using the same order
> by which elements are to be iterated upon or listed, in various other
> circumstances.

Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/