Skip to content

Make ClassDef.metaclass an Expression instead of str #3847

Closed

Description

@elazarg

Currently the metaclass node is assumed to be a string. This is inconsistent, requires workarounds such as passing '<error>' from the parser to the semantic analysis phase, and makes it awkward to handle metaclasses that come from different contexts (as in python2).

Making it an Expression works cleanly as far as I can tell, and reduces code duplication.

Activity

  1. ilevkivskyi commented on Aug 19, 2017

    @ilevkivskyi
    Member

    Makes sense to me. But what are arguments in favour of strings, why metaclasses are implemented like this?

  2. elazarg commented on Aug 19, 2017

    @elazarg
    ContributorAuthor

    It was introduced in this commit from 2013. I guess making it an expression at that time was too general.

  3. added a commit that references this issue on Aug 30, 2017
    60527de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions