[Python-Dev] Son of PEP 246, redux

Phillip J. Eby pje at telecommunity.com
Thu Jan 13 14:52:21 CET 2005


At 10:18 PM 1/13/05 +1000, Nick Coghlan wrote:
>Michael Walter wrote:
>>Yepyep, but *how* you declare types now? Can you quickly type the function
>>def f(x): x.read()? without needing an interface interface x_of_f: def
>>read(): pass or a decorator like @foo(x.read)? I've no idea what you
>>mean, really :o)
>
>Why would something like
>
>   def f(x):
>     x.read()
>
>do any type checking at all?

It wouldn't.  The idea is to make this:

    def f(x:file):
        x.read()

automatically find a method declared '@implements(file.read,X)' where X is 
in x.__class__.__mro__ (or the equivalent of MRO if x.__class__ is classic).



More information about the Python-Dev mailing list