Package pygeodesy :: Module props :: Class Property
[frames] | no frames]

Class Property

object --+            
         |            
  property --+        
             |        
 _PropertyBase --+    
                 |    
       Property_RO --+
                     |
                    Property

Instance Methods
 
__init__(self, method, doc='')
New mutable, caching, memoizing property Factory to be used as decorator.
 
setter(self, method)
Make this Property mutable.
 
setter_(self, method)
Make this Property mutable.

Inherited from Property_RO: __get__

Inherited from _PropertyBase: deleter, getter

Inherited from property: __delete__, __getattribute__, __new__, __set__

Inherited from object: __delattr__, __format__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from property: fdel, fget, fset

Inherited from object: __class__

Method Details

__init__ (self, method, doc='')
(Constructor)

 

New mutable, caching, memoizing property Factory to be used as decorator.

Arguments:
  • method - The callable being decorated as this property's getter, to be invoked only once.
  • doc - Optional property documentation (str).
Overrides: object.__init__

Note: Like standard Python property without a setter, but with a more descriptive error message when set.

See Also:
Python 3's functools.cached_property and -.cache to cache or memoize the property value., Luciano Ramalho, "Fluent Python", O'Reilly, 2016 p. 636 Example 19-24 or 2022 p. 870 Example 22-28 and class Property.

setter (self, method)

 

Make this Property mutable.

Arguments:
  • method - The callable being decorated as this Property's setter.
Overrides: property.setter

Note: Setting a new property value always clears the previously cached or memoized value after invoking the method.

setter_ (self, method)

 

Make this Property mutable.

Arguments:
  • method - The callable being decorated as this Property's setter and returning the new property value to be cached or memoized.