[issue33055] bytes does not implement __bytes__()

2018-03-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In any case this is a duplicate of 24234 -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Should we define complex.__complex__ and bytes.__bytes__? ___ Python tracker

[issue33055] bytes does not implement __bytes__()

2018-03-16 Thread Terry J. Reedy
Terry J. Reedy added the comment: It is against Guido's general policy to add things not needed purely for consistency. Unless there is a compelling use case, I think this should be closed. FHTM: I don't think Serhiy posts on SO, so you might consider adding his answer to yours, or make it

[issue33055] bytes does not implement __bytes__()

2018-03-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This isn't one exception. For example complex doesn't have the __complex__ method. __str__, __float__, __int__ and __bool__ are implemented in str, float, int and bool because there are corresponding special slots in a type object. But __bytes__ and __comp

[issue33055] bytes does not implement __bytes__()

2018-03-12 Thread FHTMitchell
New submission from FHTMitchell : Every object which has a corresponding dunder protocol also implements said protocol with one exception: >>> 'hello'.__str__() 'hello' >>> (3.14).__float__() 3.14 >>> (101).__int__() 101 >>> True.__bool__() True >>> iter(range(10)).__iter__() >>> b'hello