[Python-checkins] r82760 - python/branches/py3k/Doc/glossary.rst
georg.brandl
python-checkins at python.org
Sat Jul 10 12:39:57 CEST 2010
Author: georg.brandl
Date: Sat Jul 10 12:39:57 2010
New Revision: 82760
Log:
#3214: improve description of duck-typing in glossary.
Modified:
python/branches/py3k/Doc/glossary.rst
Modified: python/branches/py3k/Doc/glossary.rst
==============================================================================
--- python/branches/py3k/Doc/glossary.rst (original)
+++ python/branches/py3k/Doc/glossary.rst Sat Jul 10 12:39:57 2010
@@ -154,9 +154,9 @@
object.
duck-typing
- A pythonic programming style which determines an object's type by inspection
- of its method or attribute signature rather than by explicit relationship
- to some type object ("If it looks like a duck and quacks like a duck, it
+ A programming style which does not look at an object's type to determine
+ if it has the right interface; instead, the method or attribute is simply
+ called or used ("If it looks like a duck and quacks like a duck, it
must be a duck.") By emphasizing interfaces rather than specific types,
well-designed code improves its flexibility by allowing polymorphic
substitution. Duck-typing avoids tests using :func:`type` or
More information about the Python-checkins
mailing list