Skip to content

Implement PEP 562: module __getattr__ and __dir__ #76406

Closed

Description

@ilevkivskyi
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']

    Activity

    1. self-assigned this
      on Dec 5, 2017
    2. ncoghlan commented on Dec 10, 2017

      @ncoghlan
      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.

    3. ilevkivskyi commented on Dec 14, 2017

      @ilevkivskyi
      MemberAuthor

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

    4. ilevkivskyi commented on Dec 14, 2017

      @ilevkivskyi
      MemberAuthor

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

    5. methane commented on Jan 19, 2018

      @methane
      Member

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

      BTW, would you update the PEP status to Final?

    6. ilevkivskyi commented on Jan 20, 2018

      @ilevkivskyi
      MemberAuthor

      BTW, would you update the PEP status to Final?

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

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    3.7 (EOL)end of lifeinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions