This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Help us improve Python packaging - Donate today!
Project Description

Python partial on steroids

Like python functools.partial but with change/extend access to args and kwargs. Also a great tool even if no partial is needed but the function takes args/kwargs that often depends on logic.

Easiest used as a decorator

from partialize import partialize

def dummy(a, b, c=None):
    return 'hello world'

partial_dummy = dummy.partial(1)
partial_dummy.b = 2

or invoked inline…

partial_dummy = partialize(dummy)
partial_dummy.a = 1

Use it on functions that needs logic to affect arguments passed, instead of building and passing a dict as kwargs which often gets quite messy and hard to read.

Dict kwargs example:

from partialize import partialize

def search_products(site, query=None, brand=None, tags=None):

kwargs = {}

if logic:
    kwargs['query'] = q

if more_logic:
    kwargs['brand'] = 'brand name'

products = search_products(site, **kwargs)

Partialize example:

search = search_products.partial(site)

if logic:
    search.query = q

if more_logic:
    search.brand = 'brand name'

products = search()
Note: function argument names are validated when set, unlike dict string keys.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
partialize-0.0.3.tar.gz (4.7 kB) Copy SHA256 Checksum SHA256 Source May 14, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting