This document is for Kombu's development version, which can be significantly different from previous releases. Get the stable docs here: 4.5.

Object/Property Utilities - kombu.utils.objects

Object Utilities.

class kombu.utils.objects.cached_property(fget=None, fset=None, fdel=None, doc=None)[source]

Cached property descriptor.

Caches the return value of the get method on first call.


def connection(self):
    return Connection()

@connection.setter  # Prepares stored value
def connection(self, value):
    if value is None:
        raise TypeError('Connection must be a connection')
    return value

def connection(self, value):
    # Additional action to do at del(self.attr)
    if value is not None:
        print('Connection {0!r} deleted'.format(value)