GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Revert "get type from function annotation" · Issue #209 · dry-python/classes

Revert "get type from function annotation" #209

New issue
Copy link
New issue
Copy link
Closed
#207
Closed
Revert "get type from function annotation"#209
#207
Copy link
Assignees
sobolevn

Description

@sobolevn
sobolevn
opened on Jun 7, 2021
Issue body actions

Ok, I really thought that this is a good idea. But, now it seems to me that I was wrong.

Why?

  1. First of all, it is very limited. For example, you cannot write def a(instance: Union[str, bytes]). We can only work with Instance types because of the limited runtime-dispatch capabilities
  2. It makes our code much more complex. And I mean it! With this feature we now have to typecheck a whole other set of cases. Let's see some examples:
def ex():
   ...

some.instance(ex)  # will typecheck, because we allow callables, but should not.
# So, we need a plugin support for this - and it is really complex, because it has lots of corner cases
  1. It makes our code much less type-safe. There are cases when Callable should not be allowed into first .instance() call
  2. Runtime algorithm is not perfect as well, it is now focused on getattr(arg, '__annotations__') and the thing is arg might have __annotations__ even if it is not a function. So, I need to figure out another solution. But, probably the best way to solve this is to remove this feature

So, I have decided to remove this. Yes, it is a breaking changed, but there are just several users, and upgrade is really easy.

Reverts #136

Activity

  1. sobolevn
    self-assigned this
    on Jun 7, 2021
  2. sobolevn
    added a commit that references this issue on Jun 7, 2021

    Closes #209

    This issue will close once commit 37c99d8 is merged into the 'master' branch.
    37c99d8
  3. sobolevn
    closed this as completedin #207on Jun 11, 2021
  4. sobolevn
    added a commit that references this issue on Jun 11, 2021

    Closes #209

    This issue will close once commit 2894b6c is merged into the 'master' branch.
    2894b6c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @sobolevn
    sobolevn

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.