8000 114-medium-factory-pattern · Issue #11 · kracekumar/python-typing-koans · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
114-medium-factory-pattern #11
Open
@J0

Description

@J0

Hey @kracekumar,

Thanks for taking the time to reply to all my past queries. I'm a little stuck on 114 and was wondering if you could provide a hint or suggestion of sorts. I'm currently using overloaded method signatures for sock_type in the following format:

@overload
def _sock_type(addr: Tuple[str,int])-> Union[TCPSocket,TCP6Socket]:...
@overload
def _sock_type(addr: Union[str, bytes])-> UnixSocket:...


def _sock_type(addr: Address):
      <implementation details>

However, this solution still uses union and unfortunately it also means that sock_type in the line below is TCP Socket, TCP6Socket or Unix Socket whic produces the type error sock_type is not callable.

sock = sock_type(address, conf, log)

Was wondering if you have any hints/suggestions/tips.

Let me know

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0