Skip to content

Support class fields: classfield() ? #35

Open

Description

@smarie

A use case cited in this stackoverflow discussion is to define class fields, so that subclasses are restricted when they override them.

Maybe classfield() could be easily done, similarly to field()

Activity

  1. smarie commented on Oct 18, 2019

    @smarie
    OwnerAuthor

    It could be done easily (see branch https://github.com/smarie/python-pyfields/tree/class_fields) but python descriptors do not currently support that __set__ is called for class binding. It is not clear from the doc https://docs.python.org/3/reference/datamodel.html#invoking-descriptors

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

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions