[Python-checkins] r46530 - python/trunk/Lib/functools.py

nick.coghlan python-checkins at python.org
Mon May 29 22:27:44 CEST 2006


Author: nick.coghlan
Date: Mon May 29 22:27:44 2006
New Revision: 46530

Added:
   python/trunk/Lib/functools.py   (contents, props changed)
Log:
When adding a module like functools, it helps to let SVN know about the file.

Added: python/trunk/Lib/functools.py
==============================================================================
--- (empty file)
+++ python/trunk/Lib/functools.py	Mon May 29 22:27:44 2006
@@ -0,0 +1,26 @@
+"""functools.py - Tools for working with functions
+"""
+# Python module wrapper for _functools C module
+# to allow utilities written in Python to be added
+# to the functools module.
+# Written by Nick Coghlan <ncoghlan at gmail.com>
+#   Copyright (c) 2006 Python Software Foundation.
+
+from _functools import partial
+__all__ = [
+    "partial",
+]
+
+# Still to come here (need to write tests and docs):
+#   update_wrapper - utility function to transfer basic function
+#                    metadata to wrapper functions
+#   WRAPPER_ASSIGNMENTS & WRAPPER_UPDATES - defaults args to above
+#           (update_wrapper has been approved by BDFL)
+#   wraps - decorator factory equivalent to:
+#               def wraps(f):
+#                     return partial(update_wrapper, wrapped=f)
+#
+# The wraps function makes it easy to avoid the bug that afflicts the
+# decorator example in the python-dev email proposing the
+# update_wrapper function:
+# http://mail.python.org/pipermail/python-dev/2006-May/064775.html
\ No newline at end of file


More information about the Python-checkins mailing list