[Python-checkins] peps: Document the .registry attribute
lukasz.langa
python-checkins at python.org
Sat May 25 20:06:04 CEST 2013
http://hg.python.org/peps/rev/2813a160b568
changeset: 4911:2813a160b568
user: Łukasz Langa <lukasz at langa.pl>
date: Sat May 25 20:05:45 2013 +0200
summary:
Document the .registry attribute
files:
pep-0443.txt | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/pep-0443.txt b/pep-0443.txt
--- a/pep-0443.txt
+++ b/pep-0443.txt
@@ -137,6 +137,18 @@
>>> fun.dispatch(dict)
<function fun at 0x103fe4788>
+To access all registered overloads, use the read-only ``registry``
+attribute::
+
+ >>> fun.registry.keys()
+ dict_keys([<class 'NoneType'>, <class 'int'>, <class 'object'>,
+ <class 'decimal.Decimal'>, <class 'list'>,
+ <class 'float'>])
+ >>> fun.registry[float]
+ <function fun_num at 0x1035a2840>
+ >>> fun.registry[object]
+ <function fun at 0x103170788>
+
The proposed API is intentionally limited and opinionated, as to ensure
it is easy to explain and use, as well as to maintain consistency with
existing members in the ``functools`` module.
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list