On 5/13/2021 12:41 PM, Ethan Furman wrote:
On 5/13/21 2:15 AM, Irit Katriel via Python-Dev wrote:
>>> help(traceback.print_exception) Help on function print_exception in module traceback:
print_exception(exc, /, value=<object object at 0x000002825DF09650>, tb=<object object at 0x000002825DF09650>, limit=None, file=None, chain=True)
On 5/13/21 5:37 AM, Eric V. Smith wrote:
The help looks like:
field(*, default=<dataclasses._MISSING_TYPE object at 0x6fffffe46610>, default_factory=<dataclasses._MISSING_TYPE object at 0x6fffffe46610>, init=True, repr=True, hash=None, compare=True, metadata=None)
None of this is particularly awesome, but no one has complained about it yet.
Consider me complaining. ;-)
Your complaint is hereby noted!
Looks to me like the default repr for the sentinels is making those helps much less helpful by showing totally irrelevant information and cluttering up the screen making it harder to see the actually useful bits.
An actual Sentinel class would be helpful:
>>> class Sentinel: ... def __init__(self, repr): ... self.repr = repr ... def __repr__(self): ... return self.repr ...
>>> MISSING = Sentinel('MISSING') >>> MISSING MISSING
dataclasses.py actually has similar code, but for some reason I guess it got missed for MISSING (ha!).
Naturally, since sentinels are symbolic names, I think it should go into the enum module. ;-) Although I will concede that we could just put those five lines into the modules that need it.
Yeah, it's probably not worth dataclasses importing enum just to get that functionality.