Skip to content

drop type from enums for actual enums #442

Closed
@jkowalleck

Description

@jkowalleck

adding a type to an enum is a lazy and error-prone way to inherit the needed functionality from primitives.

  • instead of "equal"(==) a "identical"(is) to be used.
  • if mathematical comparrisson ala != > >= == <= < was required, then it should be implemented by hand with the correct operations and NotImplemented errors
  • if hasing was needed, then it should be done based on the case's name.

from

class SchemaVersion(str, Enum):
  foo: str = '1' 
  ...

to

class SchemaVersion(Enum):
  foo: str = '1' 
  ...

possibly a breaking change

does not apply to the schema-internal enums,
does only apply to:

  • schema.Format -- unique auto
  • schema.SchemaVersion -- tuple of int with compare

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions