mirror of
https://github.com/python/cpython.git
synced 2025-09-28 11:15:17 +00:00
#3214: improve description of duck-typing in glossary.
This commit is contained in:
parent
0310a83e7f
commit
73b1c7ba7d
1 changed files with 3 additions and 3 deletions
|
@ -154,9 +154,9 @@ Glossary
|
||||||
object.
|
object.
|
||||||
|
|
||||||
duck-typing
|
duck-typing
|
||||||
A pythonic programming style which determines an object's type by inspection
|
A programming style which does not look at an object's type to determine
|
||||||
of its method or attribute signature rather than by explicit relationship
|
if it has the right interface; instead, the method or attribute is simply
|
||||||
to some type object ("If it looks like a duck and quacks like a duck, it
|
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,
|
must be a duck.") By emphasizing interfaces rather than specific types,
|
||||||
well-designed code improves its flexibility by allowing polymorphic
|
well-designed code improves its flexibility by allowing polymorphic
|
||||||
substitution. Duck-typing avoids tests using :func:`type` or
|
substitution. Duck-typing avoids tests using :func:`type` or
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue