[issue31816] Unexpected behaviour of `dir()` after implementation of __dir__

2017-10-19 Thread Nils Diefenbach

New submission from Nils Diefenbach <23okrs20+pyt...@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 
<https://bugs.python.org/issue31816>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31816] Unexpected behaviour of `dir()` after implementation of __dir__

2017-10-19 Thread Nils Diefenbach

Nils Diefenbach <23okrs20+pyt...@mykolab.com> added the comment:

Alright. Are there any other magic methods that do some post-processing on a 
custom implementation of them ? 

I couldn't think of one, which is why this behaviour appeared odd to me.

--
status: pending -> open

___
Python tracker 
<https://bugs.python.org/issue31816>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com