For version 3.7.1 of the Transcrypt Python to JavaScript compiler I am currently using the new @dataclass
decorator. I had expected that ==, !=, <, >, >=, <=
would be supported, as per the PEP's abstract, but it doesn't seem to be the case:
from dataclasses import dataclass
@dataclass
class C:
x: int = 10
Some comparisons are not working:
>>> c1 = C(1)
>>> c2 = C(2)
>>> c1 == c2 # ok
False
>>> c1 < c2 # crash
TypeError: '<' not supported between instances of 'C' and 'C'
Why are the comparison operators not supported, except for ==
and !=
? Or did I overlook something?