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 — Getting type_argument from function annotation · Issue #136 · dry-python/classes

Getting type_argument from function annotation #136

New issue
Copy link
New issue
Copy link
Closed
Closed
Getting type_argument from function annotation#136
Copy link
Labels
enhancementNew feature or requestNew feature or request

Description

@notpushkin
notpushkin
opened on Jan 26, 2021
Issue body actions

Hey @sobolevn!

functools.singledispatch now supports using type annotations instead of passing an argument:

@singledispatch
def fun(arg, verbose=False):
    ...

@fun.register
def _(arg: int, verbose=False):
    ...

The old syntax still works, but in simple cases like here this helps reduce unnecessary repetition and, as a result, the code looks a bit cleaner.

Would you be interesting in accepting a PR implementing similar interface for _TypeClass.instance?

Activity

  1. sobolevn commented on Jan 26, 2021

    @sobolevn
    sobolevn
    on Jan 26, 2021
    Member
    More actions

    I would love to!

  2. sobolevn
    added
    enhancementNew feature or requestNew feature or request
    on Feb 16, 2021
  3. sobolevn
    added a commit that references this issue on May 12, 2021

    Closes #136

    This issue will close once commit 90faab9 is merged into the 'master' branch.
    90faab9
  4. sobolevn
    added a commit that references this issue on May 28, 2021

    Closes #136

    This issue will close once commit 2568580 is merged into the 'master' branch.
    2568580
  5. sobolevn
    closed this as completedin be13224on May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestNew feature or request

    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.