Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #63745

Re: Python 3 __bytes__ method

References <52D1E0CE.5030906@stoneleaf.us> <CACoeR0yZMGG8zsYKmF4MBjjeh3G-CUpYRbsBdNsufVNkjiap0g@mail.gmail.com> <52D1E830.8070305@stoneleaf.us>
Date 2014-01-11 21:19 -0500
Subject Re: Python 3 __bytes__ method
From Daniel da Silva <var.mail.daniel@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5353.1389496044.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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 <ethan@stoneleaf.us> wrote:

> 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
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python 3 __bytes__ method Daniel da Silva <var.mail.daniel@gmail.com> - 2014-01-11 21:19 -0500

csiph-web