mmerickel / wired

A service locator implementation for Python.
https://wired.readthedocs.io
MIT License
17 stars 9 forks source link

Use a TypeVar so container.get returns a type of the thing it is looking up #39

Closed pauleveritt closed 4 years ago

pauleveritt commented 4 years ago

We should be able to to T =TypeVar('T') at the top, then:

    def get(
        self,
        iface_or_type: T=Interface,
        *,
        context=_marker,
        name='',
        default=_marker
    ) -> T:
    ...
pauleveritt commented 4 years ago

This is dumb. .get doesn't have to return a "type" that matches what is being looked up.