[Python-Dev] subclassing builtin data structures
Georg Brandl
g.brandl at gmx.net
Sat Feb 14 20:36:26 CET 2015
On 02/14/2015 07:26 PM, Alexander Belopolsky wrote:
> In the case of int, there is a good reason for this behavior - bool. In python,
> we want True + True == 2. In numpy, where binary operations preserve
> subclasses, you have
>
>>>> import numpy
>>>> numpy.bool_(1) + numpy.bool_(1)
> True
I don't think numpy.bool_ subclasses some class like numpy.int_.
Georg
More information about the Python-Dev
mailing list