partial with out of order arguments

Category: Python - Miscellaneous

Working with Windows API which usually takes like a zillion for each function can be a little bit frustrating and if I want to only change two in the middle for each call I had to wrap everything into lambda functions which change arguments to the order that I need to use with partial.

So finally I added kinda dangerous decorator which inserts keywords into right position if detected and was about to use it but ctypes functions don't accept keyword arguments :D so just ended up with decorator :) Date: 25 May, 2012


Decorator - Partial

Homepage: http://code.activestate.com/recipes/577922-partial-with-out-of-order-arguments/?in=lang-python

Developer: Przemyslaw Podczasi

License: Freeware

Operating System: Windows

Add a Comment

all are required fields

     
What do you think of this resource?

Select Your Rate:

Votes:0

 

Related Scripts Download

This script defines a "decorator" that, rather than decorating the function, calls it, passing it a file object that it had opened as the first argument.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script tries to be a safer and faster memoize decorator, it works with mutable types and with keyword args too.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


Defining a property involves the definition of nested functions for one or more of fget,fset,fdel.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script is a decorator for automatic code optimization.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


Decorator for main method script shows how to do the same thing with a decorator that makes the code much cleaner.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script defines a decorator that allows for an abbreviated slice syntax in function arguments: {start:end}.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script is a caching decorator that collects garbage in a separate thread (for performance).

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


Implemented an SQL style INNER JOIN for two lists of tuples to be joined on a common field.

developer Developer: Raymond Hettinger
license License: Freeware
operating systems Operating System: Windows


A simple block function that lets one send multi line blocks of code to a function
it doesn't really act like a normal def/lambda but offers cool style.

developer Developer: yoav glazner
license License: Python License
operating systems Operating System: Windows