Starting from version 1.4, Psyco exports two extension types: psyco.compact and psyco.compacttype. (In some future version, Psyco may be able to patch the features implemented by these types directly into the standard interpreter's built-in types).
__slots__-constrained instances. For example, an instance with two integer attributes uses around 180 bytes in plain Python, and only around 44 if you use
__slots__or with psyco.compact. The advantage over
__slots__is that you don't have to know all possible attributes in advance.
x.attr=(a,b,c)stores the individual values of
cdirectly into the instance data without building a tuple in memory.
There are a few visible differences and limitations:
__dict__attribute returns a dictionary proxy (which however supports all dict operations, including writes).
__dict__, a copy of the data is stored into the instance; the dict and the instance do not reflect each other's future changes (they do in plain Python).
__members__attribute which lists the current attributes, in the order in which they have been set.
__bases__attribute will always contain psyco.compact as the last item, even if one or several other base classes were specified.
__delslot__show up for internal purposes.
Note that you should not mix psyco.compacttype classes and normal classes in the same hierarchy. Although this might work, the instances will still each have an unused allocated dictionary.