New submission from Maxim Avanov <[email protected]>:
>From my understanding of the docs section on new types,
>https://docs.python.org/3/library/typing.html#newtype the new type based on
int() should just pass the value into the base constructor. However,
```
PercentDiscount = NewType('PercentDiscount', int)
>>> PercentDiscount(50) == int(50)
True
>>> int('50') == int(50)
True
>>> PercentDiscount('50') == PercentDiscount(50)
False
```
----------
components: Library (Lib)
messages: 314598
nosy: avanov
priority: normal
severity: normal
status: open
title: New type based on int() created with typing.NewType is not consistent
versions: Python 3.6
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33170>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com