Author gvanrossum
Recipients Austin Bingham, christian.heimes, gvanrossum, mark.dickinson, rhettinger, robert_smallshire, serhiy.storchaka, tim.peters
Date 2020-10-04.19:16:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Possibly at some point in the future we can switch to using typing.Protocol, which requires neither registration nor explicit subclassing (it's like Hashable). This makes it easy for user code to define custom protocols as needed. So if you need something that has .keys() and .items() but you don't care about .values() you can just write

class KeysAndItems(typing.Protocol):
    def keys(self): ...
    def items(self): ...

def my_func(x: KeysAndItems):

This can be statically checked using e.g. mypy.
Date User Action Args
2020-10-04 19:16:05gvanrossumsetrecipients: + gvanrossum, tim.peters, rhettinger, mark.dickinson, christian.heimes, serhiy.storchaka, robert_smallshire, Austin Bingham
2020-10-04 19:16:05gvanrossumsetmessageid: <>
2020-10-04 19:16:05gvanrossumlinkissue26680 messages
2020-10-04 19:16:05gvanrossumcreate