>>>>
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.  ;-)

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

    >>> implicit = Sentinel('<implicit>')
    >>> implicit
    <implicit>

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.

--
~Ethan~
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/7S5PU6334ZZXCA3EFV244YZWY27KA3FD/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to