diff options
| author | int3l <viderbit@abv.bg> | 2016-04-23 03:24:29 +0300 |
|---|---|---|
| committer | int3l <viderbit@abv.bg> | 2016-04-23 03:24:29 +0300 |
| commit | fc47a49587f1af6ea0db0804be2d984042486cd2 (patch) | |
| tree | 8a167f8515c5a39c3cba9d3326d08b16967dcd9f | |
| parent | f5de93f1c156fd4659a191c7c78554645534968d (diff) | |
| download | pyramid-fc47a49587f1af6ea0db0804be2d984042486cd2.tar.gz pyramid-fc47a49587f1af6ea0db0804be2d984042486cd2.tar.bz2 pyramid-fc47a49587f1af6ea0db0804be2d984042486cd2.zip | |
import/docstring adjustments in decorator module
| -rw-r--r-- | pyramid/decorator.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/pyramid/decorator.py b/pyramid/decorator.py index df30c5e10..890bd3461 100644 --- a/pyramid/decorator.py +++ b/pyramid/decorator.py @@ -1,4 +1,4 @@ -import functools +from functools import update_wrapper class reify(object): @@ -19,17 +19,22 @@ class reify(object): And usage of Foo: >>> f = Foo() - >>> v = f.jammy + >>> print(f.jammy) 'jammy called' - >>> print(v) 1 - >>> f.jammy + >>> print(f.jammy) 1 >>> # jammy func not called the second time; it replaced itself with 1 + + Note: reassignment is possible + + >>> f.jammy = 2 + >>> f.jammy + 2 """ def __init__(self, wrapped): self.wrapped = wrapped - functools.update_wrapper(self, wrapped) + update_wrapper(self, wrapped) def __get__(self, inst, objtype=None): if inst is None: |
