A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-August/028026.html below:

PEP 218 (sets); moving set.py to Lib

[Python-Dev] Re: PEP 218 (sets); moving set.py to LibFrançois Pinard pinard@iro.umontreal.ca
19 Aug 2002 10:51:29 -0400
[Guido van Rossum]

> [François]
> > [...] why the sorting/non-sorting virtues of `repr' should be tied
> > with the constructor.  [...]

> If dicts can survive being rendered unsorted, then so can Sets.  Maybe I
> should remove the sort_repr argument altogether; it's easy enough for
> the test suite to use some other trick.

I presume you already have a solution when testing dicts?

> But for now, I'll just leave sort_repr=False in.

As long as users do not discover it, they will not use it! :-)

By the way (this was discussed on Python list a while ago), it might
be worth stressing in the official documentation that dicts, and maybe
Sets as well, all have a "natural" iteration order which remains fixed at
least while the dict or Set does not loose or acquire keys, and that this
same fixed order is used for .items(), .keys(), .values(), and all three
.iter* flavours.  It is sometimes useful being able to rely on this fact,
especially if Python clearly commits itself through the documentation.

The printing order for dicts and Sets could be documentated as a simple
way to reveal the current "natural" fixed order.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4