Skip to content

SymbolTable.get_identifiers() docstring return value incorrect #93660

Description

@pamelafox

Documentation

SymbolTable.get_identifiers() currently says:
"Return a list of names of symbols in this table."

However, the returned value is actually dict_keys, a dictionary view object, which doesn't support everything that a list does (notably, it's not subscriptable).

I have a PR with a proposed change incoming.

Activity

  1. pamelafox commented on Jun 9, 2022

    @pamelafox
    ContributorAuthor

    Alternatively, that method could return a list by wrapping the return value in list(), but that could potentially be backward incompatible so I assume its preferable to just update the documentation.

  2. hauntsaninja commented on Jun 10, 2022

    @hauntsaninja
    Contributor

    Thanks for spotting this! As an aside, looks like the type in typeshed is also incorrect, in case you feel like making another PR: https://github.com/python/typeshed/blob/ad48606a0d901d907f2428917d7a5f97959b4733/stdlib/symtable.pyi#L21 :-)

  3. pamelafox commented on Jun 10, 2022

    @pamelafox
    ContributorAuthor

    Sure, typeshed PR is here:
    python/typeshed#8054
    CPython PR is here:
    #93661

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc direasy

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions