QUERY · ISSUE
py: bytes() won't call obj.__bytes__()
docs
I defined a class with bytes method. Calling bytes() on its instance should redirect to its bytes method, but it doesn't.
Can this be fixed?
CANDIDATE · ISSUE
Limited special method support for classes inherited from native types
class bytes_(bytes): pass
bytes() + bytes_()
TypeError: unsupported types for add: 'bytes', 'bytes_'
This passes in python3 without problem.
Goal: I'm missing some extended functionality in built-in types (like bytes.translate), so I wanted to patch them by pure python implementation in overloaded class. Of course I can implement them in separate object instead, but it's missing a beauty of transparency.