These are chat archives for ipython/ipython
Hi all, I wonder why ipython (using Python 3.6.5) tab completion completes some attributes but not others:
In : import sys In : sys.stdout.<TAB> sys.stdout.encoding sys.stdout.flush sys.stdout.errors sys.stdout.write
I know that there are other (public) attributes from
dir(sys.stdout) and because one has to use
sys.stdout.buffer.write() to write binary data to standard output.
Is there a way to 'hide' certain attributes from tab completion in my own classes?
MyClass.__dir__()from the docs, but oddly (for me that is), it appears that the
_io.TextIOWrapperbuilt-in class for
sys.stdoutuses the default implementation for
__dir__(), so I guess it isn't using this particular trick.