> Can't you write this as a simple Python function using
> type.__basicsize__ and type.__itemsize__?
Yes, it would be possible and has been done, e.g.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/546530. The
problem is though, that it requires handling of all special cases
externally. Any changes need to be addressed separately and unknown type
definitions cannot be addressed at all. Also I figured the programmer
implementing a type would know best about its size. Another point is
different architectures which result in different object sizes.
> In any case, if this is added somewhere it should not be a builtin.
What place would you consider to be appropriate?