Descriptor support for NIPY.
Utilities to support special Python descriptors [1,2], in particular the use of a useful pattern for properties we call ‘one time properties’. These are object attributes which are declared as properties, but become regular attributes once they’ve been read the first time. They can thus be evaluated later in the object’s life cycle, but once evaluated they become normal, static attributes with no function call overhead on access or any other constraints.
[1] How-To Guide for Descriptors, Raymond Hettinger. http://users.rcn.com/python/download/Descriptor.htm
[2] Python data model, http://docs.python.org/reference/datamodel.html
digraph inheritance9efd33ad1d { rankdir=LR; ratio=compress; fontsize=14; size="6.0, 8.0"; "OneTimeProperty" [shape=ellipse,URL="nibabel.onetime.OneTimeProperty.html#nibabel.onetime.OneTimeProperty",fontname=Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans,fontsize=14,color=dodgerblue1,style=filled,height=0.75]; }
Functions
setattr_on_read(func) | Decorator to create OneTimeProperty attributes. |
Classes
OneTimeProperty(func) | A descriptor to make special properties that become normal attributes. |