GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Make singledispatch only evaluate annotation for dispatched arg · Issue #110373 · python/cpython Open Labels stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-featureA feature request or enhancementA feature request or enhancement DescriptionIn the example below, we have no real need to evaluate the type annotations of the non-dispatched args. Skipping this might improve performance / import time a little. from __future__ import annotations from functools import singledispatch @singledispatch def fun(arg, verbose): print("arg", type(arg)) @fun.register def _(arg: int, verbose: 1/0): print("arg", type(arg)) @fun.register def _(arg: list, verbose: 1/0): print("arg", type(arg)) Reacted by Alex Waygood and Matthew Scheifer Activity
MetadataMetadataAssigneesLabelsstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-featureA feature request or enhancementA feature request or enhancement ProjectsMilestoneRelationshipsDevelopmentIssue 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. |