[New-bugs-announce] [issue31816] Unexpected behaviour of `dir()` after implementation of __dir__

Nils Diefenbach report at bugs.python.org
Thu Oct 19 03:48:26 EDT 2017


New submission from Nils Diefenbach <23okrs20+python at mykolab.com>:

When defining a custom __dir__ method in a class, calling dir() on
said class still sorts the output. This is, imo, unexpected behaviour, especially if the order of output was specified in __dir__ and is somehow relevant.

Example and more detail here
https://stackoverflow.com/questions/46824459/custom-dir-returns-list-of-attributes-sorted-alphabetically

----------
messages: 304606
nosy: nlsdfnbch
priority: normal
severity: normal
status: open
title: Unexpected behaviour of `dir()` after implementation of __dir__
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31816>
_______________________________________


More information about the New-bugs-announce mailing list