Skip to content

Implement PEP 562: module __getattr__ and __dir__ #76406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ilevkivskyi opened this issue Dec 5, 2017 · 5 comments
Closed

Implement PEP 562: module __getattr__ and __dir__ #76406

ilevkivskyi opened this issue Dec 5, 2017 · 5 comments
Assignees
Labels
3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@ilevkivskyi
Copy link
Member

BPO 32225
Nosy @ncoghlan, @methane, @ilevkivskyi
PRs
  • bpo-32225: Implementation of PEP 562 #4731
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ilevkivskyi'
    closed_at = <Date 2017-12-14.11:19:15.626>
    created_at = <Date 2017-12-05.20:30:14.925>
    labels = ['interpreter-core', 'type-feature', '3.7']
    title = 'Implement PEP 562: module __getattr__ and __dir__'
    updated_at = <Date 2018-01-20.01:07:47.069>
    user = 'https://github.com/ilevkivskyi'

    bugs.python.org fields:

    activity = <Date 2018-01-20.01:07:47.069>
    actor = 'levkivskyi'
    assignee = 'levkivskyi'
    closed = True
    closed_date = <Date 2017-12-14.11:19:15.626>
    closer = 'levkivskyi'
    components = ['Interpreter Core']
    creation = <Date 2017-12-05.20:30:14.925>
    creator = 'levkivskyi'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32225
    keywords = ['patch']
    message_count = 5.0
    messages = ['307935', '308285', '308290', '310271', '310313']
    nosy_count = 3.0
    nosy_names = ['ncoghlan', 'methane', 'levkivskyi']
    pr_nums = ['4731']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue32225'
    versions = ['Python 3.7']

    @ilevkivskyi ilevkivskyi added the 3.7 (EOL) end of life label Dec 5, 2017
    @ilevkivskyi ilevkivskyi self-assigned this Dec 5, 2017
    @ilevkivskyi ilevkivskyi added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Dec 5, 2017
    @ncoghlan
    Copy link
    Contributor

    For documentation of this feature, I'd suggest adding a new subsection after https://docs.python.org/3/reference/datamodel.html#customizing-attribute-access (but at the same level), called "Customizing module attribute access".

    That can then cover defining __getattr__ and __dir__ as module level functions, and also mention setting __class__ (which would be enough to close bpo-27505 as well).

    The new section should explicitly mention that these only affect lookups and modifications made using the attribute access syntax - directly accessing the module globals (whether by code within the module, or via a reference to the module's globals dict) is unaffected.

    @ilevkivskyi
    Copy link
    Member Author

    New changeset 5364b5c by Ivan Levkivskyi in branch 'master':
    bpo-32225: Implementation of PEP-562 (bpo-4731)
    5364b5c

    @ilevkivskyi
    Copy link
    Member Author

    Travis build on master successful, so I am closing this issue.

    @methane
    Copy link
    Member

    methane commented Jan 19, 2018

    I didn't notice this is implemented.
    Congrats, Ivan!

    BTW, would you update the PEP status to Final?

    @ilevkivskyi
    Copy link
    Member Author

    BTW, would you update the PEP status to Final?

    Good point, here is the PR python/peps#554

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants