about summary refs log tree commit diff stats
path: root/tools/lynx.html
diff options
context:
space:
mode:
authorSilvino Silva <silvino@bk.ru>2016-09-29 05:21:34 +0100
committerSilvino Silva <silvino@bk.ru>2016-09-29 05:21:34 +0100
commit81d7c7820c25cdca723bbe7c13a3657174904b70 (patch)
tree984cd63c11d252b82a55901be38cb66a53cfc4f7 /tools/lynx.html
parent17bc450495c9ab6933590fb825dbd80b0af64a66 (diff)
downloaddoc-81d7c7820c25cdca723bbe7c13a3657174904b70.tar.gz
postgresql revision
Diffstat (limited to 'tools/lynx.html')
0 files changed, 0 insertions, 0 deletions
ass='oid'>7f906f5f ^
d1a1173d ^











7f906f5f ^
d1a1173d ^



7f906f5f ^
d1a1173d ^





c1b42fd5 ^
b3d031a9 ^
c1b42fd5 ^
d1a1173d ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

                                                                
                                                                  
 
 
                                                                                   
                                                      
 











                                              
 



                                       
 





                                                   
 
 
                          

                     
# From http://blog.pythonisito.com/2008/08/lazy-descriptors.html

from __future__ import (absolute_import, division, print_function)


class lazy_property(object):  # pylint: disable=invalid-name,too-few-public-methods
    """A @property-like decorator with lazy evaluation

    >>> class Foo:
    ...     @lazy_property
    ...     def answer(self):
    ...         print("calculating answer...")
    ...         return 2*3*7
    >>> foo = Foo()
    >>> foo.answer
    calculating answer...
    42
    >>> foo.answer
    42
    """

    def __init__(self, method):
        self._method = method
        self.__name__ = method.__name__
        self.__doc__ = method.__doc__

    def __get__(self, obj, cls=None):
        if obj is None:  # to fix issues with pydoc
            return None
        result = self._method(obj)
        obj.__dict__[self.__name__] = result
        return result


if __name__ == '__main__':
    import doctest
    doctest.testmod()