[Python-Dev] type categories
Sat, 24 Aug 2002 17:53:46 +0200
> - inherit from a class without implementing that class's interfaces
> - declare that a class implements an interface outside the class
I would like to add and restate my proposal to allow also for refering to
anonymous super-interfaces of an interface in terms of the interface plus a
subset of its signatures, also e.g. FileLike and just 'write'.
[that means an interface can be thought to correspond to a set of
(tag,signature) tuples, where tag identifies the interface, and one can also
just consider subsets of it]
I really think that such a feature would allow interfaces to better mix and
match with how currently Python code is written. Or at least ease the
transition from an interfaces-less world.
This may seem YAGNI, but I clearly remember people stating (on types-sig) the
need to refer to an interface of just the granularity of just file-like 'read'
or just __getitem__. Having to name them is overkill, having to implement all
the methods of an interface corresponding to a base Python type also.
It is a burden to implement and may seem complex, but I feel, it matches how we
code in Python - implementing e.g. just subsets of interfaces corresponding to
a base Python type - and still allowing to have interface checking precision.