[Python-Dev] Let's get rid of unbound methods (original) (raw)
Phillip J. Eby pje at telecommunity.com
Tue Jan 4 19:51:42 CET 2005
- Previous message: [Python-Dev] Let's get rid of unbound methods
- Next message: [Python-Dev] Let's get rid of unbound methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 01:36 PM 1/4/05 -0500, Jim Fulton wrote:
duck typing?
AKA latent typing or, "if it walks like a duck and quacks like a duck, it must be a duck." Or, more pythonically:
if hasattr(ob,"quack") and hasattr(ob,"duckwalk"):
# it's a duck
This is as distinct from both 'if isinstance(ob,Duck)' and 'if implements(ob,IDuck)'. That is, "duck typing" is determining an object's type by inspection of its method/attribute signature rather than by explicit relationship to some type object.
- Previous message: [Python-Dev] Let's get rid of unbound methods
- Next message: [Python-Dev] Let's get rid of unbound methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]