specify types in method calls

Mark McEahern mark at mceahern.com
Sun Feb 1 10:27:01 EST 2004


Uwe Mayer wrote:

>Hi,
>
>sometimes I'd like to be able to specify that a parameter to a method call
>should be of a specific instance. I can do that using the isinstance()
>buildin in the body of the method.
>

The Pythonic way seems to prefer a polymorphic approach; that is, rather 
than focus on what type things are, the real question is whether they 
behave in an expected way.  Here's a reference to PyProtocols and PEP 246:

  http://peak.telecommunity.com/PyProtocols.html

// m




More information about the Python-list mailing list