[New-bugs-announce] [issue41780] Generic Alias attributes nor in dir()

Allan Daemon report at bugs.python.org
Mon Sep 14 03:06:06 EDT 2020


New submission from Allan Daemon <rea.aft at gmail.com>:

The implementation of PEP 585 in 3.9 adds some new attributes, but they aren't listed with dir() (then, not list in autocomplete and IntelliSense).

Python 3.9.0rc1+ (heads/3.9:d7cd1164c1, Aug 25 2020, 17:27:09)

>>> li = list[int]
>>> li.__origin__
<class 'list'>
>>> getattr(li, '__origin__')
<class 'list'>
>>> '__origin__' in dir(li)
False

That applies to:

__origin__
__args__
__parameters__

It seems to be not the expected behaviour, so this bug report. If this is not the case, some piece of documentation could be interesting. Also, I couldn't find anything about Generic Alias in the documentation, only in the source code. Should this be addressed too?

----------
assignee: docs at python
components: Documentation, Library (Lib)
messages: 376873
nosy: AllanDaemon, docs at python
priority: normal
severity: normal
status: open
title: Generic Alias attributes nor in dir()
type: behavior
versions: Python 3.10, Python 3.9

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


More information about the New-bugs-announce mailing list