7 Jun
2016
7 Jun
'16
4:51 a.m.
On 06.06.16 20:05, Émanuel Barry wrote:
While I'm at it, maybe other methods could use that, too (thinking mainly of __int__, __float__, __abs__, __complex__, __round__, __index__, and maybe __len__ and __iter__).
This would break a lot of code that just checks the existence of corresponding methods. Even if change all this code to call corresponding methods and check the result, this would affect the performance.
Thoughts? Is it reasonable to define a single class that can work with both str and bytes, or should I fix my code?
Define tree classes. A base class, its constructor returns an instance of appropriate child class, and two child classes for str and bytes.