Skip to main content

singledispatch-with-type-arg-support

Standalone "preview" of https://github.com/python/cpython/pull/100624

Based off cpython commit c4c5790120beabed83ce5855f18d209ab8324434

Installation

Requires a sufficiently recent Python 3.12 version (some tests fail with earlier 3.12 versions, although the main functionality might still work - do your own testing).

pip3 install singledispatch-with-type-arg-support

Example

See example.py:

from singledispatch_with_type_arg_support import singledispatch

@singledispatch
def describe(x) -> str:
  raise TypeError(f"no description for {repr(x)}")

@describe.register
def _(x: type[int]) -> str:
  return "the integer type"

print(describe(int))  # should print: the integer type

License

Same as CPython (as 99% of it is copied from there), see LICENSE file.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

singledispatch_with_type_arg_support-0.1.3.tar.gz (10.2 kB view details)

Uploaded Source

File details

Details for the file singledispatch_with_type_arg_support-0.1.3.tar.gz.

File metadata

File hashes

Hashes for singledispatch_with_type_arg_support-0.1.3.tar.gz
Algorithm Hash digest
SHA256 906b7454cb907453d1668c283a1bfeaa2d6120feb0a353222a53f4d52d705627
MD5 2b7bfe8abb4ade8589c0fc2c542b2a91
BLAKE2b-256 d895692075c684cebee03832bd171745e71e159c7177799f840cb4850ea14f17

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.3 This release

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page