Re: [Tutor] struct question

2009-02-03 Thread Alan Gauld
"bob gailer" wrote >>> struct.calcsize('s') 1 >>> struct.calcsize('d') 8 >>> struct.calcsize('sd') 16 Why? Should not that be 9? Numbers always start on word boundaries. struct.calcsize('ds') 9 Alan G. ___ Tutor maillist - Tutor@python.or

Re: [Tutor] struct question

2009-02-03 Thread Kent Johnson
On Tue, Feb 3, 2009 at 2:03 PM, Marc Tompkins wrote: > More results to chew on: > struct.calcsize('s') > 1 struct.calcsize('d') > 8 struct.calcsize('sd') > 16 struct.calcsize('ds') > 9 struct.calcsize('dss') > 10 struct.calcsize('dss') > 14 struct.calcsize('

Re: [Tutor] struct question

2009-02-03 Thread Marc Tompkins
On Tue, Feb 3, 2009 at 11:05 AM, bob gailer wrote: > I have submitted this as a bug. Same behavior with c instead of s. > I don't think it's a bug. Each double requires 8 bytes; that 8 bytes needs to start at an 8-byte boundary. If your struct starts with a 1-byte object, then some empty paddi

Re: [Tutor] struct question

2009-02-03 Thread bob gailer
W W wrote: On Tue, Feb 3, 2009 at 6:25 PM, bob gailer > wrote: >>> struct.calcsize('s') 1 >>> struct.calcsize('d') 8 >>> struct.calcsize('sd') 16 Why? Should not that be 9? >>> struct.calcsize('ds') 9 at least on the current box I'm ru

Re: [Tutor] struct question

2009-02-03 Thread Marc Tompkins
On Tue, Feb 3, 2009 at 10:29 AM, W W wrote: > > > On Tue, Feb 3, 2009 at 6:25 PM, bob gailer wrote: > >> >>> struct.calcsize('s') >> 1 >> >>> struct.calcsize('d') >> 8 >> >>> struct.calcsize('sd') >> 16 >> >> Why? Should not that be 9? >> > > >>> struct.calcsize('ds') > 9 > > at least on the cur

Re: [Tutor] struct question

2009-02-03 Thread W W
On Tue, Feb 3, 2009 at 6:25 PM, bob gailer wrote: > >>> struct.calcsize('s') > 1 > >>> struct.calcsize('d') > 8 > >>> struct.calcsize('sd') > 16 > > Why? Should not that be 9? > >>> struct.calcsize('ds') 9 at least on the current box I'm running. It also gave me this: >>> struct.calcsize('sd')

[Tutor] struct question

2009-02-03 Thread bob gailer
>>> struct.calcsize('s') 1 >>> struct.calcsize('d') 8 >>> struct.calcsize('sd') 16 Why? Should not that be 9? -- Bob Gailer Chapel Hill NC 919-636-4239 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor