Am 12.01.2014 01:24 schrieb Ethan Furman:
I must admit I'm not entirely clear how this should be used. Is anyone
using this now? If so, how?
I am not, as I currently am using Py2, but if I would, I would do it e.
g. for serialization of objects in order to send them over the line or
to sav
On Sat, Jan 11, 2014 at 9:44 PM, Ethan Furman wrote:
> On 01/11/2014 06:19 PM, Daniel da Silva wrote:
>
>>
>> One use case is:
>> Suppose you have existing function that accepts a /bytes/ object. If you
>> subclass /bytes/ and want it to be guaranteed
>> to work with that function, you can overri
On 01/11/2014 08:56 PM, Daniel da Silva wrote:
I agree with you that realistic use cases are hard to think of.
Does that answer your question better?
Well, since I was asking if anybody was already using the feature, no. ;)
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list
One use case is:
Suppose you have existing function that accepts a *bytes* object. If you
subclass *bytes* and want it to be guaranteed to work with that function,
you can override* __bytes__()* to use the logistics of your subclass
implementation.
On Sat, Jan 11, 2014 at 7:56 PM, Ethan Furman w
On 01/11/2014 06:19 PM, Daniel da Silva wrote:
One use case is:
Suppose you have existing function that accepts a /bytes/ object. If you
subclass /bytes/ and want it to be guaranteed
to work with that function, you can override/__bytes__()/ to use the logistics
of your subclass implementation.
Where did you read this? I can't find any documentation about __bytes__ on
google.
Regards,
Daniel
On Sat, Jan 11, 2014 at 7:24 PM, Ethan Furman wrote:
> Python 3 has a new method, __bytes__. The docs say: Called by bytes() to
> compute a byte-string representation of an object. This should r
On 01/11/2014 04:53 PM, Daniel da Silva wrote:
Where did you read this? I can't find any documentation about __bytes__ on
google.
http://docs.python.org/3.3/reference/datamodel.html?highlight=__bytes__#object.__bytes__
--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list