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


Groups > comp.lang.python > #63743 > unrolled thread

Re: Python 3 __bytes__ method

Started byEthan Furman <ethan@stoneleaf.us>
First post2014-01-11 18:44 -0800
Last post2014-01-11 18:44 -0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Python 3 __bytes__ method Ethan Furman <ethan@stoneleaf.us> - 2014-01-11 18:44 -0800

#63743 — Re: Python 3 __bytes__ method

FromEthan Furman <ethan@stoneleaf.us>
Date2014-01-11 18:44 -0800
SubjectRe: Python 3 __bytes__ method
Message-ID<mailman.5352.1389494690.18130.python-list@python.org>
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.

I don't think so, for two reasons:

1) bytes objects do not have a __bytes__ method,

2) if the function is expecting a bytes object, it is unlikely to call bytes() on it.

--
~Ethan~

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web