Re: Struct class random access

2008-08-26 Thread castironpi
On Aug 26, 12:41 am, castironpi [EMAIL PROTECTED] wrote: On Aug 25, 11:47 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 25 Aug 2008 14:49:14 -0700, castironpi wrote: I'm interested in the speed benefit, so you don't have to reconstruct the entire 'record' just to

Struct class random access

2008-08-25 Thread castironpi
struct.Struct lets you encode Python objects into structured memory. It accepts a format string, and optionally a buffer and offset to/from which to read/write the structure. What do you think of random access for the results? (unproduced) packer= struct.Struct( 'IIIf255p' ) packer.pack_into(

Re: Struct class random access

2008-08-25 Thread Marc 'BlackJack' Rintsch
On Mon, 25 Aug 2008 13:03:09 -0700, castironpi wrote: struct.Struct lets you encode Python objects into structured memory. It accepts a format string, and optionally a buffer and offset to/from which to read/write the structure. What do you think of random access for the results?

Re: Struct class random access

2008-08-25 Thread castironpi
On Aug 25, 4:25 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 25 Aug 2008 13:03:09 -0700, castironpi wrote: struct.Struct lets you encode Python objects into structured memory. It accepts a format string, and optionally a buffer and offset to/from which to read/write the

Re: Struct class random access

2008-08-25 Thread castironpi
On Aug 25, 4:49 pm, castironpi [EMAIL PROTECTED] wrote: On Aug 25, 4:25 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 25 Aug 2008 13:03:09 -0700, castironpi wrote: struct.Struct lets you encode Python objects into structured memory. It accepts a format string, and

Re: Struct class random access

2008-08-25 Thread Marc 'BlackJack' Rintsch
On Mon, 25 Aug 2008 14:49:14 -0700, castironpi wrote: I'm interested in the speed benefit, so you don't have to reconstruct the entire 'record' just to read/write one 'field'. How in ctypes? Only the field accessed is converted. Ciao, Marc 'BlackJack' Rintsch --

Re: Struct class random access

2008-08-25 Thread castironpi
On Aug 25, 11:47 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Mon, 25 Aug 2008 14:49:14 -0700, castironpi wrote: I'm interested in the speed benefit, so you don't have to reconstruct the entire 'record' just to read/write one 'field'.  How in ctypes? Only the field accessed is