Whining about "struct"
Ned Deily
nad at acm.org
Thu Oct 14 02:17:04 EDT 2010
In article <am1db6h9dh3abep1g3s21bqf3172fa3ve8 at 4ax.com>,
Tim Roberts <timr at probo.com> wrote:
> I have a bad memory. I admit it. Because of that, the Python "help"
> system is invaluable to me. Up through Python 2.5, I could get a quick
> reference to the format specifiers for the struct module via
> import struct; help(struct)
>
> I used that a LOT.
>
> But in Python 2.6, the struct module moved from Python code to C code, and
> that helpful help string was removed.
>
> Is that still gone in Python 3.1? What are the chances of reinstating that
> helpful chart?
Hmm, for me, help(struct) produces pretty similar results on all pythons
from 2.5 through 3.2. (This is on Mac OS X with the Pythons from
various sources.) Here's a snippet from the 3.1.2 help:
[...]
DESCRIPTION
Functions to convert between Python values and C structs.
Python bytes objects are used to hold the data representing the C
struct
and also as format strings (explained below) to describe the layout
of data
in the C struct.
The optional first format char indicates byte order, size and
alignment:
@: native order, size & alignment (default)
=: native order, std. size & alignment
<: little-endian, std. size & alignment
>: big-endian, std. size & alignment
!: same as >
The remaining chars indicate types of args and must match exactly;
[...]
Is that what you meant? Ah, I see. It looks like the doc string was
missing-in-action in the initial 2.6 releases but subsequently fixed (as
of 2.6.5 or so).
--
Ned Deily,
nad at acm.org
More information about the Python-list
mailing list