Format: application/x-python-code
1 o
2
3 �h_ � @ st d Z ddlmZ ddlmZ e� Ze� Zeddfdd�Zefdd�Z efd d
4 �Z
5 dd� ZG d
6 d� de�Z
7 dd� ZdS )z�
8 - the popular ``_memoize_default`` works like a typical memoize and returns the
9 default otherwise.
10 - ``CachedMetaClass`` uses ``_memoize_default`` to do the same with classes.
11 � ��wraps)�debugFc s � ��fdd�}|S )aO This is a typical memoization decorator, BUT there is one difference:
12 To prevent recursion it sets defaults.
13
14 Preventing recursion is in this case the much bigger use than speed. I
15 don't think, that there is a big speed difference, but there are many cases
16 where recursion could happen (think about a = b; b = a).
17 c s �� ��fdd�}|S )Nc s� �r| j }n�r|d j }n| jj }z|� }W n ty' i |�<