title: Python enum with custom class with mandatory keyword arguments
body: <p>I am trying to create an enum with custom class which has mandatory positional arguments.</p>
  <pre><code>class Coord:
    def __init__(self, *, x, y):
      self._x = x
      self._y = y
  </code></pre>
  <p>I would like to make several enums with this class.
  Somthing like:</p>
  <pre><code>class IntCoord(Coord, Enum):
    ONE_ONE = Coord(x=1, y=1)
  
  class FloatCoord(Coord, Enum):
    ONE_ONE = Coord(x=0.1, y=0.1)
  </code></pre>
  <p>So that I can use them in other class like:</p>
  <pre><code>class System(Generic[T]):
    @classmethod
    def get_one_one(cls) -&gt; T:
      return NotImplemented
  
  class IntSystem(System[IntCoord]):
    @classmethod
    def get_one_one(cls) -&gt; IntCoord:
      return IntCoord.ONE_ONE
  
  class FloatSystem(System[FloatCoord]):
    @classmethod
    def get_one_one(cls) -&gt; FloatCoord:
      return FloatCoord.ONE_ONE
  </code></pre>
  <p>After that, I want to compare the enums:</p>
  <pre><code>IntCoord(x=1, y=1) is IntSystem.get_one_one()
  </code></pre>
  <p>I am having a hard time defining the <code>Coord</code> class.
  It seems it is not possible to instantiate <code>Coord</code> enum class by <code>Coord(x=1, y=1)</code></p>
  <p>Is there a good way to achieve this with enum?
  Or better reasonable implementation?</p>
  <p>Full script is as follows:</p>
  <pre><code>from enum import Enum
  from typing import Generic, TypeVar
  
  
  class Coord:
      def __init__(self, *, x, y):
          self._x = x
          self._y = y
  
  
  class IntCoord(Coord, Enum):
      ONE_ONE = Coord(x=1, y=1)
  
  
  class FloatCoord(Coord, Enum):
      ONE_ONE = Coord(x=0.1, y=0.1)
  
  
  T = TypeVar('T', bound=Coord)
  
  
  class System(Generic[T]):
      @classmethod
      def get_one_one(cls) -&gt; T:
          return NotImplemented
  
  
  class IntSystem(System[IntCoord]):
      @classmethod
      def get_one_one(cls) -&gt; IntCoord:
          return IntCoord.ONE_ONE
  
  
  class FloatSystem(System[FloatCoord]):
      @classmethod
      def get_one_one(cls) -&gt; FloatCoord:
          return FloatCoord.ONE_ONE
  
  
  if __name__ == '__main__':
      int_one_one = IntSystem.get_one_one()
      float_one_one = FloatSystem.get_one_one()
  
      print(IntCoord(x=1, y=1) is int_one_one)
      print(FloatCoord(x=0.1, y=0.1) is float_one_one)
  
  </code></pre>
  <p>Errors are:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;test.py&quot;, line 11, in &lt;module&gt;
      class IntCoord(Coord, Enum):
    File &quot;.pyenv/versions/3.9.0/lib/python3.9/enum.py&quot;, line 228, in __new__
      enum_member.__init__(*args)
  TypeError: __init__() takes 1 positional argument but 2 were given
  </code></pre>