Table of Contents

Class: Make ./src/peak/binding/once.py

Make(recipe)' - Construct a value and cache it

Usage examples:

        class MyComponent(binding.Component):

            # this makes a new dictionary in each MyComponent instance
            aDict = binding.Make(dict)

            # this makes an instance of 'thing.Thing' in each MyComponent
            aThing = binding.Make("things.Thing")

            # 1-argument functions are called with the MyComponent instance
            someAttr = binding.Make(lamdba self: self.otherAttr * 2)

            # Types and no-argument functions are just called
            otherAttr = binding.Make(lambda: 42)

Make accepts a binding.IRecipe (or object that's adaptable to one), and uses it to compute the attribute's value. See the docs for Descriptor and Attribute for the remaining semantics of this attribute type.

XXX need more docs for adaptations to 'IRecipe

Base Classes   
Attribute
Methods   
__init__
__repr__
  __init__ 
__init__ (
        self,
        recipe,
        metadata=None,
        **kw,
        )

  __repr__ 
__repr__ ( self )


Table of Contents

This document was automatically generated on Mon Jan 20 01:11:03 2025 by HappyDoc version 2.1