On Mon, Dec 16, 2019, 7:35 PM David Cuthbert <da...@kanga.org> wrote:
> On Mon 12/16/19, 9:59 AM, "David Mertz" <me...@gnosis.cx> wrote: > If some improved implementation of sets had the accidental side effects of > making them ordered, I would still not want that to become a semantic > guarantee. > > Eekā¦ No accidental side effects whenever possible, please. People come to > rely upon them (like that chemistry paper example[*]), and changing the > assumptions results in a lot of breakage down the line. > I'm not sure what point you are making really. Any particular implementation will have some behaviors that are not guaranteed by the language spec. I wouldn't want to PROHIBIT a set implementation that preserved insertion order. Nor, for example, would I want to prohibit one that stored string elements in alphabetical order, if that somehow had an independent performance advantage. But that's very different from wanting to REQUIRE sets to iterate in alphabetical order. If they did that, it wouldn't be *wrong*, but it also shouldn't be something we rely on. > [*] > https://arstechnica.com/information-technology/2019/10/chemists-discover-cross-platform-python-scripts-not-so-cross-platform/ > > This is interesting. But it's a programming error that Python, or any programming language, can not perfect against. glob.glib() does not promise to list matching files in any specific order. If the authors wrote code whose results vary based on the particular order files are processed in, that's a bug. It's their responsibility to order the files appropriately. Obviously, glob COULD alphabetize it's results. But that order is generally different from ordering by creation time. Which is, in turn, different from ordering by modification time or file size. I don't want to prohibit glob from doing any of these if the filesystem happens to make such easier (this is really a filesystem question more than an OS question). But I also don't want to make the order part of the semantics of the function... Nor do extra work to "randomize" the order to avoid some pattern that may happen to exist on some platform.
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/PHXPPDOMX4UHSGCAEO5APGC5KCUPEANM/ Code of Conduct: http://python.org/psf/codeofconduct/