Nick Coghlan | 0849014 | 2006-05-29 20:27:44 +0000 | [diff] [blame] | 1 | """functools.py - Tools for working with functions |
| 2 | """ |
| 3 | # Python module wrapper for _functools C module |
| 4 | # to allow utilities written in Python to be added |
| 5 | # to the functools module. |
| 6 | # Written by Nick Coghlan <ncoghlan at gmail.com> |
| 7 | # Copyright (c) 2006 Python Software Foundation. |
| 8 | |
| 9 | from _functools import partial |
| 10 | __all__ = [ |
| 11 | "partial", |
| 12 | ] |
| 13 | |
| 14 | # Still to come here (need to write tests and docs): |
| 15 | # update_wrapper - utility function to transfer basic function |
| 16 | # metadata to wrapper functions |
| 17 | # WRAPPER_ASSIGNMENTS & WRAPPER_UPDATES - defaults args to above |
| 18 | # (update_wrapper has been approved by BDFL) |
| 19 | # wraps - decorator factory equivalent to: |
| 20 | # def wraps(f): |
| 21 | # return partial(update_wrapper, wrapped=f) |
| 22 | # |
| 23 | # The wraps function makes it easy to avoid the bug that afflicts the |
| 24 | # decorator example in the python-dev email proposing the |
| 25 | # update_wrapper function: |
| 26 | # http://mail.python.org/pipermail/python-dev/2006-May/064775.html |