[Python-Dev] boxing and unboxing data types

Steven D'Aprano steve at pearwood.info
Mon Mar 9 16:46:59 CET 2015


On Mon, Mar 09, 2015 at 09:52:01AM -0400, Neil Girdhar wrote:

> Here is a list of methods on
> int that should not be on IntFlags in my opinion (give or take a couple):
> 
> __abs__, __add__, __delattr__, __divmod__, __float__, __floor__,
> __floordiv__, __index__, __lshift__, __mod__, __mul__, __pos__, __pow__,
> __radd__, __rdivmod__, __rfloordiv__, __rlshift__, __rmod__, __rmul__,
> __round__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__,
> __sub__, __truediv__, __trunc__, conjugate, denominator, imag, numerator,
> real.
> 
> I don't think __index__ should be exposed either since are you really going
> to slice a list using IntFlags?  Really?

In what way is this an *Int*Flags object if it is nothing like an int? 
It sounds like what you want is a bunch of Enum inside a set with a custom 
__str__, not IntFlags.


-- 
Steve


More information about the Python-Dev mailing list