Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Utility framework for easier & more robust duck typing in Python

Project Description

pyduck is a Python utility framework for more effective usage of language’s defining traits: duck typing. It enhances the language with several useful features that increase the readability and reliability of Python code.

from pyduck import Interface, expects, Any, overload

class Iterable(Interface):
    def __iter__(self): pass

def __iterable_as_json(value):
    json_list = map(as_json, value)
    return "[%s]" % str.join(",", json_list)

def __string_as_json(value):
    return '"%s"' % str(value)

def __other_as_json(value):
    return str(value)

as_json = overload(__iterable_as_json, __string_as_json, __other_as_json)


  • interfaces which do not need to be explicitly declared (similar to Go language)
  • automatic interface/type checking for function arguments
  • function overloading based on interfaces/types of arguments
  • automatic interface/type checking for function return values

For more info & the docs, see the project’s webpage.

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(8.5 kB) Copy SHA256 Hash SHA256
Source None Nov 16, 2011

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Google Google Cloud Servers Fastly Fastly CDN StatusPage StatusPage Statuspage DigiCert DigiCert EV Certificate