From: "David Abrahams" <dave@boost-consulting.com> > All of my (dynamically-generated) extension classes need a piece of data > which tells them how much extra data to allocate in the variable-sized area > of their instances. This is an implementation detail which I don't want to Not so different from what I need... > expose to users. Right now I have to stick it in the class' __dict__, which > not only means that it's exposed, but that users can change it at will. It > also costs me an extra lookup every time an instance of the extension class > is allocated. It would be much nicer if I could get a little data area in > the type object where I could stick this value, but right now there's no > place to put it. You can (but you probably know this already) replace the type's tp_dict by a custom subclass of PyDict_Object, which adds additional fields. > Chris' patch allows me to handle the issue much more naturally. It doesn't > seem esoteric to add information to a type which doesn't live it its > __dict__. Not being able to do so makes types very different from other > objects. Actually this is not specific to types - it is for all variable size objects. Thomas
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4