On Wed, Sep 10, 2014 at 6:50 PM, Stephen J. Turnbull <stephen@xemacs.org> wrote:
Chris Lasher writes:

 > Okay, but a definite -1e6 from me on making my Python interpreter do this:
 >     >>> my_packed_bytes = struct.pack('ffff', 3.544294848931151e-12,
 > 1.853266900760489e+25, 1.6215185358725202e-19, 0.9742483496665955)
 >     >>> my_packed_bytes
 >     b'Why, Guido? Why?'

If you actually have a struct, why aren't you wrapping
your_packed_bytes in a class that validates the struct and displays it
nicely formatted?  Or, alternatively, simply replaces __repr__?

The point was to demonstrate that although text must be represented by bytes, not all bytes represent text. I have the bytes from four 32-bit floating point numbers, but repr() displays these bytes as ASCII characters. It looks like I wrote "Why, Guido? Why?" illustrating how implicit behavior that's "usually helpful" can be rather unhelpful. Explicitly showing the hexadecimal values is always accurate, because bytes are always bytes.
Your judgment doesn't rule, and it definitely doesn't have a weight of
I meant the "-1e6" as a cheeky response, not as a reflection of the importance of my opinions or ideas.