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


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

Python 3 __bytes__ method

Started byEthan Furman <ethan@stoneleaf.us>
First post2014-01-11 16:24 -0800
Last post2014-01-15 13:07 +0100
Articles 2 — 2 participants

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


Contents

  Python 3 __bytes__ method Ethan Furman <ethan@stoneleaf.us> - 2014-01-11 16:24 -0800
    Re: Python 3 __bytes__ method Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2014-01-15 13:07 +0100

#63734 — Python 3 __bytes__ method

FromEthan Furman <ethan@stoneleaf.us>
Date2014-01-11 16:24 -0800
SubjectPython 3 __bytes__ method
Message-ID<mailman.5344.1389487577.18130.python-list@python.org>
Python 3 has a new method, __bytes__.  The docs say: Called by bytes() to compute a byte-string representation of an 
object. This should return a bytes object.

I must admit I'm not entirely clear how this should be used.  Is anyone using this now?  If so, how?

--
~Ethan~

[toc] | [next] | [standalone]


#63973

FromThomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
Date2014-01-15 13:07 +0100
Message-ID<lb5tmn$heh$1@r01.glglgl.de>
In reply to#63734
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 save them into a file. IOW, the same purpose as we havd on __str__ in 
Py2.


Thomas

[toc] | [prev] | [standalone]


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


csiph-web