You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a number of places where you want to specify some kind of object for a given type (gracefully handling subtypes, lazy registration, etc.). For example, in IPython, I want to register a pretty-printer function for numpy arrays. Or in Traits UI, I might want to make an InstanceEditor implementation that looks up a Controller/ModelView from one of these registries to wrap around a model object. I use (a vendorized version of) this code in qt_binder to map Qt widget types to Binder classes.
It is similar to functools.singledispatch and our adaptation subsystem except that the mapped object is entirely general, not just a function that will be called on the object or an adapter wrapped around it. It's a light-weight implementation of the concept, and the registry object can be explicitly managed (i.e. no hidden global state unless if you decide to hide it somewhere).
This is a comparatively recent addition to apptools. It should be documented with examples of the problems it is idesigned to solve.
The text was updated successfully, but these errors were encountered: