I am working on a CUDA python API using ctypes. Within CUDA there are vector
type structs defined (float2, float3, float4, int2, int3, int4, ...), all of
which have an alignment specification (example of how this is specified
https://stackoverflow.com/questions/12778949/cuda-memory-alignment/127
On 2019-12-02 09:55:16 -0800, Rob Gaddi wrote:
> The struct situation is, as you said, a bit different. I believe that with
> the default native alignment @, you're seeing 4-byte data padded to an
> 8-byte alignment, not 8-byte data.
Nope. That's really an 8 byte long:
Py
DON'T have exact control with those sizes, it just happens
> > that all the platforms you are using happen to have the same size for
> > those types.
>
> According to the docs for struct (python 2.7 and python 3.8) I do have
> exact control for the types I listed.
You also have exact
his returns 8.
>>>> Documentation at https://docs.python.org/3/library/array.html explicitly
>>>> states 'L' is for size 4.
>>>> It impacts all uses types of array (e.g. reading from byte strings).
>>>> The struct module is a little different:
pical
> but *not* guaranteed sizes", that would be more clear.
>
I think array.array() is possibly the wrong tool for this job. If you
have a collection of bytes from some well-defined source (eg you're
parsing a file in a known format), struct is better suited to it,
because it's
by using the word "minimum".
Minimum would suggest that it would accept a 4-byte value as a minimum and on
64-bit it does *not*, it hard fails. If it were to document that, "the sizes
are native integer types for the platform, the table documents some typical but
*not* guaranteed
On 12/2/19 5:50 PM, Richard Damon wrote:
Perhaps array could be extended so that it took '4' for a 4 byte integer
and '8' for an 8 byte integer (maybe 'U4' and 'U8' for unsigned). Might
as well also allow 1 and 2 for completeness for char and short (but
those are currently consistent).
I wil
tes 'L' is for size 4.
>>> It impacts all uses types of array (e.g. reading from byte strings).
>>> The struct module is a little different:
>>> import struct
>>> x = struct.pack('L', 0)
>>> # len(x) ===8 rather than 4
>>>
states 'L' is for size 4.
>>> It impacts all uses types of array (e.g. reading from byte strings).
>>> The struct module is a little different:
>>> import struct
>>> x = struct.pack('L', 0)
>>> # len(x) ===8 rather than 4
>>&
under Windows Python 3.7.3 64-bit build.
>> Under Ubuntu; Python 2.7.15rc1, 3.6.5, 3.70b3 64-bit this returns 8.
>> Documentation at https://docs.python.org/3/library/array.html explicitly
>> states 'L' is for size 4.
>> It impacts all uses types of array (e.g. readi
returns 8.
Documentation at https://docs.python.org/3/library/array.html explicitly states
'L' is for size 4.
It impacts all uses types of array (e.g. reading from byte strings).
The struct module is a little different:
import struct
x = struct.pack('L', 0)
# len(x) ===8 rather tha
Ubuntu; Python 2.7.15rc1, 3.6.5, 3.70b3 64-bit this returns 8.
> Documentation at https://docs.python.org/3/library/array.html explicitly
> states 'L' is for size 4.
> It impacts all uses types of array (e.g. reading from byte strings).
>
> The struct module is a little
thon.org/3/library/array.html explicitly states
'L' is for size 4.
It impacts all uses types of array (e.g. reading from byte strings).
The struct module is a little different:
import struct
x = struct.pack('L', 0)
# len(x) ===8 rather than 4
This can be worked around by
inhahe wrote:
> I need to make a list of instances of a Structure, then I need to make an
> instance of another Structure, one of the fields of which needs to be an
> arbitrary-length array of pointers to the instances in the list. How do I
> do that?
>
> Just in case it helps, I'll include what
On Fri, 10 Aug 2018 18:40:11 -0400, inhahe wrote:
> I need to make a list of instances of a Structure, then I need to make
> an instance of another Structure, one of the fields of which needs to be
> an arbitrary-length array of pointers to the instances in the list. How
> do I do that?
>
> Just
I need to make a list of instances of a Structure, then I need to make an
instance of another Structure, one of the fields of which needs to be an
arbitrary-length array of pointers to the instances in the list. How do I
do that?
Just in case it helps, I'll include what I tried that didn't work:
-
Rudi Lopez Lopez :
> from struct import pack
>
> print(hex(126))
> print(pack('>H',126))
I can't see any bug. The tilde (~) has an ASCII code 126.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Mar 24, 2016 at 7:17 PM, Rudi Lopez Lopez wrote:
> from struct import pack
>
> print(hex(126))
> print(pack('>H',126))
Explain the bug?
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
from struct import pack
print(hex(126))
print(pack('>H',126))
Rudi G. Lopez
--
https://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
>On Mon, 16 Nov 2015 05:15 pm, Gregory Ewing wrote:
>
>> Ints are not the only thing that // can be applied to:
>>
>> >>> 1.0//0.01
>> 99.0
>
>Good catch!
Hmmm. I see that the float for 0.01 _is_ slightly larger than 0.01
>>> Decimal(0.01)
Decimal('0.012
On Tue, Nov 17, 2015 at 12:17 AM, Steven D'Aprano wrote:
> On Sun, 15 Nov 2015 01:23 pm, Chris Angelico wrote:
>
>> On Sun, Nov 15, 2015 at 1:08 PM, Steven D'Aprano
>> wrote:
>>> number = +raw_input("enter a number: ")
>>>
>>> versus:
>>>
>>> text = raw_input("enter a number: ")
>>> try:
>>>
On Sun, 15 Nov 2015 01:23 pm, Chris Angelico wrote:
> On Sun, Nov 15, 2015 at 1:08 PM, Steven D'Aprano
> wrote:
>> number = +raw_input("enter a number: ")
>>
>> versus:
>>
>> text = raw_input("enter a number: ")
>> try:
>> number = float(text)
>> except ValueError:
>> number = int(text)
>
On Mon, 16 Nov 2015 05:15 pm, Gregory Ewing wrote:
> Ian Kelly wrote:
>> Unary integer division seems pretty silly since the only possible results
>> would be 0, 1 or -1.
>
> Ints are not the only thing that // can be applied to:
>
> >>> 1.0//0.01
> 99.0
Good catch!
--
Steven
--
https:/
Chris Angelico wrote:
Small problem: Since we have / and // operators, it's impossible to
have a unary / operator:
No, it's not -- '//' is already recognised as a single
token distinct from '/ /'. You would just have to leave
a space or use parens in some cases.
--
Greg
--
https://mail.python.
Ian Kelly wrote:
Unary integer division seems pretty silly since the only possible results
would be 0, 1 or -1.
Ints are not the only thing that // can be applied to:
>>> 1.0//0.01
99.0
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wrote:
And we'd be left looking for a symbol for bitwise inversion.
Who needs negation when you have bitwise inversion?
minusx = ~x + 1
I know, it doesn't work for floats, but that's just
a simple matter of defining ~ on floats appropriately...
--
Greg
--
https://ma
On Sun, Nov 15, 2015 at 1:08 PM, Steven D'Aprano wrote:
> number = +raw_input("enter a number: ")
>
> versus:
>
> text = raw_input("enter a number: ")
> try:
> number = float(text)
> except ValueError:
> number = int(text)
What kinds of strings can float() not handle but int() can, and in
On Sun, 15 Nov 2015 02:43 am, Ian Kelly wrote:
> On Fri, Nov 13, 2015 at 10:40 PM, Steven D'Aprano
> wrote:
>> Python has operator overloading, so it can be anything you want it to be.
>> E.g. you might have a DSL where +feature turns something on and -feature
>> turns it off.
>
> By that argume
On Sun, 15 Nov 2015 09:53 am, Random832 wrote:
> Marko Rauhamaa writes:
>> Actually, the real question is, is the unary - *really* so useful that
>> it merits existence or is it just something that was mindlessly copied
>> into programming languages from elementary school arithmetics?
>
> The al
On 2015-11-14 22:53, Random832 wrote:
Marko Rauhamaa writes:
Actually, the real question is, is the unary - *really* so useful that
it merits existence or is it just something that was mindlessly copied
into programming languages from elementary school arithmetics?
The alternative, if you wan
Random832 :
> Marko Rauhamaa writes:
>> Actually, the real question is, is the unary - *really* so useful
>> that it merits existence or is it just something that was mindlessly
>> copied into programming languages from elementary school arithmetics?
>
> The alternative, if you want to be able to
Marko Rauhamaa writes:
> Actually, the real question is, is the unary - *really* so useful that
> it merits existence or is it just something that was mindlessly copied
> into programming languages from elementary school arithmetics?
The alternative, if you want to be able to specify negative num
Ian Kelly :
> On Nov 14, 2015 9:56 AM, "Marko Rauhamaa" wrote:
>>r = //(//r1 + //r2 + //r3)
>
> Unary integer division seems pretty silly since the only possible
> results would be 0, 1 or -1.
Yep, mixed them up.
Marko
--
https://mail.python.org/mailman/listinfo/python-list
On Nov 14, 2015 10:10 AM, "Chris Angelico" wrote:
>
> On Sun, Nov 15, 2015 at 4:04 AM, Ian Kelly wrote:
> > Unary integer division seems pretty silly since the only possible
results
> > would be 0, 1 or -1.
>
> 1, -1, or ZeroDivisionError. The zero's on the other side. But yes.
// 42 == 1 // 42
On Nov 14, 2015 9:56 AM, "Marko Rauhamaa" wrote:
>
> Ian Kelly :
>
> > For somebody reading one of these uses of unary plus in real code, I
> > imagine it would be a bit of a WTF moment if it's the first time
> > they've encountered it. I don't recall ever seeing any code that
> > actually used th
On Sun, Nov 15, 2015 at 3:52 AM, Marko Rauhamaa wrote:
> What I don't understand is why there is a unary + but no unary /:
>
>-x ≡ 0 - x
>+x ≡ 0 + x
>/x ≡ 1 / x
>//x ≡ 1 // x
>*x ≡ 1 * x
>
> You could write:
>
>r = //(//r1 + //r2 + //r3)
>
> for
>
>r = 1 // (1//r1 + 1//
On Sun, Nov 15, 2015 at 2:43 AM, Ian Kelly wrote:
> On Fri, Nov 13, 2015 at 10:40 PM, Steven D'Aprano wrote:
>> Python has operator overloading, so it can be anything you want it to be.
>> E.g. you might have a DSL where +feature turns something on and -feature
>> turns it off.
>
> By that argume
Ian Kelly :
> For somebody reading one of these uses of unary plus in real code, I
> imagine it would be a bit of a WTF moment if it's the first time
> they've encountered it. I don't recall ever seeing any code that
> actually used this, though.
What I don't understand is why there is a unary +
On Fri, Nov 13, 2015 at 10:40 PM, Steven D'Aprano wrote:
> Python has operator overloading, so it can be anything you want it to be.
> E.g. you might have a DSL where +feature turns something on and -feature
> turns it off.
By that argument we should also have operators ~, !, $, \, ? because
some
On Sat, 14 Nov 2015 02:01 pm, Chris Angelico wrote:
> On Sat, Nov 14, 2015 at 1:40 PM, Steven D'Aprano
> wrote:
>> On Sat, 14 Nov 2015 09:42 am, Chris Angelico wrote:
>>
>>> However, this is a reasonable call for the abolition of unary plus...
>>
>> The only way you'll take unary plus out of Pyth
On Sat, Nov 14, 2015 at 2:48 PM, Ian Kelly wrote:
>> Yes, unary minus has the same issue - but it's a lot more important
>> than unary plus is. In ECMAScript, unary plus means "force this to be
>> a number"; what's its purpose in Python?
>
> I'm not sure "force this to be a number" is really a jus
On Sat, Nov 14, 2015 at 2:45 PM, Ian Kelly wrote:
>> Yes, unary minus has the same issue - but it's a lot more important
>> than unary plus is. In ECMAScript, unary plus means "force this to be
>> a number"; what's its purpose in Python?
>
> It forces a Counter to contain only positive counts?
Di
On Nov 13, 2015 8:03 PM, "Chris Angelico" wrote:
>
> On Sat, Nov 14, 2015 at 1:40 PM, Steven D'Aprano
wrote:
> > On Sat, 14 Nov 2015 09:42 am, Chris Angelico wrote:
> >
> >> However, this is a reasonable call for the abolition of unary plus...
> >
> > The only way you'll take unary plus out of Py
On Nov 13, 2015 8:03 PM, "Chris Angelico" wrote:
>
> On Sat, Nov 14, 2015 at 1:40 PM, Steven D'Aprano
wrote:
> > On Sat, 14 Nov 2015 09:42 am, Chris Angelico wrote:
> >
> >> However, this is a reasonable call for the abolition of unary plus...
> >
> > The only way you'll take unary plus out of Py
On Sat, Nov 14, 2015 at 1:40 PM, Steven D'Aprano wrote:
> On Sat, 14 Nov 2015 09:42 am, Chris Angelico wrote:
>
>> However, this is a reasonable call for the abolition of unary plus...
>
> The only way you'll take unary plus out of Python is by prying it from my
> cold, dead hands.
>
>
> BTW, unar
On Sat, 14 Nov 2015 09:42 am, Chris Angelico wrote:
> However, this is a reasonable call for the abolition of unary plus...
The only way you'll take unary plus out of Python is by prying it from my
cold, dead hands.
BTW, unary minus suffers from the same "problem":
x =- y # oops, meant x -= y
On Sat, Nov 14, 2015 at 6:45 AM, Ian Kelly wrote:
> This sets RegisterAX to 2. Specifically, positive 2. If you want to
> *add* 2, you probably meant to write:
>
> RegisterAX += 2
>
> This also points out a good reason for using spaces around operators,
> as "RegisterAX =+ 2" would have caused
On 2015-11-13, kent nyberg wrote:
> Though, as many times before, the problem was due to misunderstanding
> of how python works. I assumed file.read()[xx:yy] was to be
> understood as, in the file, read from index xx to place yy.
Nope.
First, the 'file.read()' part is evaluated. That return
The main problem was that I forgot to do seek(0). Thanks alot people.
Though, as many times before, the problem was due to misunderstanding of how
python works.
I assumed file.read()[xx:yy] was to be understood as, in the file, read from
index xx to place yy.
That is, [10:20] was the same a
On 2015-11-13, Ian Kelly wrote:
> Either retain the read data between calls, or call seek(0) before
> reading it again.
It has always saddened me that Python files don't have a rewind()
method. On Unix, calling rewind() is the same as calling seek(0), so
it's utterly pointless except as an amus
On Fri, Nov 13, 2015 at 1:15 PM, kent nyberg wrote:
> What bothers me, is the error that says
> unpack requires a string argument of 4 bytes.
> Im thinking in the line of arguments? Does unpack look at the 4 bytes it has
> read, and tell for some
> reason say that unpacking needs an argument of 4
On Fri, Nov 13, 2015 at 1:15 PM, kent nyberg wrote:
> Even with that, it still gets wrong.
> I also tried .read()[RegisterAX:RegisterAX+4]
When you call read for the second time, are you just reading the same
file again without closing or seeking it in the interim? If that's the
case, then you wo
I forgot to add. You get this wretched error message if your data
is shorter than expected, and you ask struct to read more than you
have, as well. most annoying.
Laura
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Nov 13, 2015 at 12:36:22PM -0700, Ian Kelly wrote:
> On Fri, Nov 13, 2015 at 12:20 PM, kent nyberg wrote:
> > def LoadCommandAndReact(place_to_read):
> > global RegisterAX
> >
> > tmp = place_to_read.read()[RegisterAX:calcsize('HH')]
>
> It looks like you're trying to get a slice
second time, unpack doesnt get the size of '>HH' to
>read. But surely
>.read()[RegisterAX:calcsize('HH')] should assure that its fed with correct
>data?
>
>I have filled the file with data of size '>HH' and first command reads that.
>So n
As long as I'm replying to this, I see a few more issues to comment on:
On Fri, Nov 13, 2015 at 12:20 PM, kent nyberg wrote:
> if place_to_read.closed:
>print("Drive error. Drive closed.")
You probably also want to break or return here. Even better: raise an
exception instead of prin
On Fri, Nov 13, 2015 at 12:20 PM, kent nyberg wrote:
> def LoadCommandAndReact(place_to_read):
> global RegisterAX
>
> tmp = place_to_read.read()[RegisterAX:calcsize('HH')]
It looks like you're trying to get a slice of length 4 here, starting
at the value of RegisterAX. What you're actual
Hi there,
Im deeply sorry for yet another question to this list. I have come across a
problem to which google seems not
to eager to supply the anwser.
The problem is the following.
First I do this:
def setup_drive():
test = pack('>HH', 0b1000, 0b10010001)
file = op
Hi Jason,
Thanks for the response. Okay, Will try to convert 'struct test' into
new python object (say 'PyStructTest') and include it inside
CountDictType as pyobject instead of 'struct'.
Will post details here, If i encounter any issues.
Cheers,
On Sat, Mar 7, 2015 at 4:15 AM, Lakshmipathi.G
wrote:
> Hi,
>
> I'm following this example :
> http://nedbatchelder.com/text/whirlext.html#h_making_a_type and trying
> to add
> new data into 'CountDict' type
>
> Adding a simple 'char' wo
Hi,
I'm following this example :
http://nedbatchelder.com/text/whirlext.html#h_making_a_type and trying
to add
new data into 'CountDict' type
Adding a simple 'char' works well.
typedef struct {
PyObject_HEAD
PyObject * dict;
int count;
char c; //add this
On 11/14/2014 10:11 AM, ast wrote:
Hello
In module wave there is a sub module struct.
struct is not a documented part of the wave module.
You can call function pack() with:
import wave
val = wave.struct.pack(...)
wave imports several other stdlib modules. All are accessible the same
way
"Peter Otten" <__pete...@web.de> a écrit dans le message de
news:mailman.15823.1415983912.18130.python-l...@python.org...
Do you see the pattern? You should ;)
Understood
thx
--
https://mail.python.org/mailman/listinfo/python-list
ast wrote:
> In module wave there is a sub module struct.
> You can call function pack() with:
>
> import wave
> val = wave.struct.pack(...)
>
> but the same function can be called with:
>
> import struct
> val = struct.pack(...)
>
> Is it exactly the sam
On Sat, Nov 15, 2014 at 2:11 AM, ast wrote:
> In module wave there is a sub module struct.
> You can call function pack() with:
>
> import wave
> val = wave.struct.pack(...)
>
> but the same function can be called with:
>
> import struct
> val = struct.pack(...)
>
Hello
In module wave there is a sub module struct.
You can call function pack() with:
import wave
val = wave.struct.pack(...)
but the same function can be called with:
import struct
val = struct.pack(...)
Is it exactly the same module in both location ?
Why putting struct in two places
On Wednesday, November 13, 2013 3:41:03 PM UTC-5, krishna...@gmail.com wrote:
> Thanks for your reply Ned!
>
> I tried this your suggestion and this is what it complains...
>
> os_inst_bytes = struct.pack('7BI512s', 0, 0x51, 0x10, 5, 0, 0xD, 0x80, 0, '')
>
> -
Correction in the last input line...
In [16]: result = struct.unpack('5p', os_inst[11:16])
---
error Traceback (most recent call last)
in ()
> 1 result = struct.unpack('5p', os_inst[11
o the IOCTL to
be able to get the data back from the driver. Without bytearray(), the ioctl
with mutable flag set to 1 would complain.
I tried to use the p format specifier with pack after converting the array
object to byte stream. Packing seems fine. However, I cant seem to unpack.
In [
On Wednesday, November 13, 2013 1:31:49 PM UTC-5, krishna...@gmail.com wrote:
> Hello,
>
> I am trying to build a structure to be passed down to an I2C device driver.
> The driver expects a struct that has a data array of size 512 bytes among
> other things. This is my code -
Hello,
I am trying to build a structure to be passed down to an I2C device driver. The
driver expects a struct that has a data array of size 512 bytes among other
things. This is my code -
rd_wr = 0x0 # Read operation
i2c_addr= addr
mux = mux_sel
multi_len
> Looks like your "e"... Is that the key field?
Yes, you are right 'e' is the key. And rest of them are data.
>AND the order of the items is "o" before "i"
>-- that doesn't seem to match your C struct definition.
Sorry, I was testing the bdb
Hi -
We have C code which writes following struct into berkeley db ("my_db.db").
struct my_info {
unsigned long int i, e;
int o;
char *f;
char *s;
};
How to read this via Python? Google search gave this code
---
$ cat pybsd2.py
from bsddb import db
fruitDB = db.DB()
fr
On Mon, 05 Dec 2011 00:20:32 -0800, Mark Dickinson wrote:
>> May be, yes, but since calcsize() is returning 12 when the elements
>> are put in the other order, it would seem to be not counting such
>> padding.
>
> Indeed. That's arguably a bug in the struct module,
On Dec 5, 8:09 am, Chris Angelico wrote:
> May be, yes, but since calcsize() is returning 12 when the elements
> are put in the other order, it would seem to be not counting such
> padding.
Indeed. That's arguably a bug in the struct module, and one that
people have had to find w
On Mon, Dec 5, 2011 at 6:42 PM, Mark Dickinson wrote:
> That's a strange way to think of it, especially since the padding also
> happens for a single struct object when there's no array present. I
> find it cleaner to think of C as having no padding in arrays, but
> p
On Dec 4, 3:17 pm, Chris Angelico wrote:
> On Mon, Dec 5, 2011 at 1:51 AM, Dave Angel wrote:
> > In C, the padding to the largest alignment occurs at the
> > end of a structure as well as between items. Otherwise, an array of the
> > struct would not be safely aligned.
gt; The eight-byte integer is aligned on an eight-byte boundary, so when
>> it follows a four-byte string, you get four padding bytes inserted.
>> Put them in the other order, and the padding disappears.
>>
> NOT disappears. In C, the padding to the largest alignment occurs at t
On Dec 4, 9:38 am, Duncan Booth wrote:
> Glen Rice wrote:
> > In IPython:
> >>import struct
> >>struct.calcsize('4s')
> > 4
> >>struct.calcsize('Q')
> > 8
> >>struct.calcsize('4sQ')
> > 16
>
>
Glen Rice wrote:
> In IPython:
>>import struct
>>struct.calcsize('4s')
> 4
>>struct.calcsize('Q')
> 8
>>struct.calcsize('4sQ')
> 16
>
> This doesn't make sense to me. Can anyone explain?
A C compiler can insert paddin
On 12/04/2011 09:35 AM, Chris Angelico wrote:
On Mon, Dec 5, 2011 at 1:25 AM, Glen Rice wrote:
In IPython:
import struct
struct.calcsize('4s')
4
struct.calcsize('Q')
8
struct.calcsize('4sQ')
16
This doesn't make sense to me. Can anyone explain?
Sa
Glen Rice wrote:
> In IPython:
>>import struct
>>struct.calcsize('4s')
> 4
>>struct.calcsize('Q')
> 8
>>struct.calcsize('4sQ')
> 16
>
> This doesn't make sense to me. Can anyone explain?
>
When you mix different
On Mon, Dec 5, 2011 at 1:25 AM, Glen Rice wrote:
> In IPython:
>>import struct
>>struct.calcsize('4s')
> 4
>>struct.calcsize('Q')
> 8
>>struct.calcsize('4sQ')
> 16
>
> This doesn't make sense to me. Can anyone explai
In IPython:
>import struct
>struct.calcsize('4s')
4
>struct.calcsize('Q')
8
>struct.calcsize('4sQ')
16
This doesn't make sense to me. Can anyone explain?
--
http://mail.python.org/mailman/listinfo/python-list
New to python and would like to test network/sockets with it.
I am having a problem where I have setup the following:
import socket, sys, struct
HOST = '1.1.1.1'
PORT = 153
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
data = struct.unpack('!
ship was accepted.
>
> Please disregard if it's a duplicate.
>
> Thanks
>
> Begin forwarded message:
>
> *From: *Johnny Venter
> *Date: *August 5, 2011 8:15:53 AM EDT
> *To: *python-list@python.org
> *Subject: **Sockets: Receiving C Struct*
>
> New to python a
I was not sure if this message was sent before my membership was accepted.
Please disregard if it's a duplicate.
Thanks
Begin forwarded message:
> From: Johnny Venter
> Date: August 5, 2011 8:15:53 AM EDT
> To: python-list@python.org
> Subject: Sockets: Receiving C Struct
&
On Tue, Nov 30, 2010 at 10:57 AM, Eric Frederich
wrote:
> I am not sure how to proceed.
> I am writing a Python interface to a C library.
> The C library uses structures.
> I was looking at the struct module but struct.unpack only seems to
> deal with data that was packed using
I am not sure how to proceed.
I am writing a Python interface to a C library.
The C library uses structures.
I was looking at the struct module but struct.unpack only seems to
deal with data that was packed using struct.pack or some other buffer.
All I have is the struct itself, a pointer in C.
Is
On 14/10/10 5:17 PM, python-list-requ...@python.org wrote:
> Subject:
> Whining about "struct"
> From:
> Tim Roberts
> Date:
> Wed, 13 Oct 2010 21:30:38 -0700
>
> To:
> python-list@python.org
>
>
> I have a bad memory. I admit it. Because of that,
On 14/10/2010 05:30, Tim Roberts 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
In message , Tim Roberts wrote:
> I have a bad memory. I admit it. Because of that, the Python "help"
> system is invaluable to me.
I’ve tried using that occasionally, but found it’s easier by far to have a
Web page open with full documentation that I can read and flip through while
simultane
In article ,
Tim Roberts 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)
On 10/14/2010 12:30 AM, Tim Roberts 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
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 mo
inhahe wrote:
> On Aug 13, 4:07 pm, Peter Otten <__pete...@web.de> wrote:
>> inhahe wrote:
>> > say i have this definition:
>>
>> > 1 typedef struct SDL_Surface {
>> > 2 Uint32 flags; /* Read-only */
>> > 3
On Aug 13, 4:07 pm, Peter Otten <__pete...@web.de> wrote:
> inhahe wrote:
> > say i have this definition:
>
> > 1 typedef struct SDL_Surface {
> > 2 Uint32 flags; /* Read-only */
> > 3 SDL_PixelFormat *format;
inhahe wrote:
> say i have this definition:
>
>1 typedef struct SDL_Surface {
>2 Uint32 flags; /* Read-only */
>3 SDL_PixelFormat *format;/* Read-only */
>4 int w, h; /* R
say i have this definition:
1 typedef struct SDL_Surface {
2 Uint32 flags; /* Read-only */
3 SDL_PixelFormat *format;/* Read-only */
4 int w, h; /* Read-only */
5 Uint16 pitch
On 05/19/2010 02:53 PM, Back9 wrote:
Can anyone explain the difference between f and d in struct unpack?
When using them, some data work in either one not both.
To me it seems to be same,
TIA
'f' is single precision float (32 bits), and
'd' is a double precision f
1 - 100 of 423 matches
Mail list logo