wrenoud / structobject

A verbose pythonic semantic for describing binary data structures and associated python objects.
Apache License 2.0
1 stars 0 forks source link

structObject.size for objects with fixed binary representations #10

Open wrenoud opened 10 years ago

wrenoud commented 10 years ago

This will have to look at the segments to determine if they have variable lengths.

wrenoud commented 10 years ago

Nevermind, this is available on an instantiated structObject, i.e.

In [11]: class Point(structObject):
             "Basic point class"
             _field_order = ('x','y')
             x = ctype_double()
             y = ctype_double()
         Point().size
Out[11]: 16

But i'm going to leave this open for now because it might be nice to add this as a class attribute. The only downside is that is some cases the size will be not be computable because of variable segments of the object.