coldfix/black-magic — pull request #2 by coldfix (2014-03-12 19:55:47+00:00)
Title: functools.partial is not usable

In most cases, the signature of a `functools.partial` can not be used by `ASTorator`: arguments with default values are

- ~~present in the signature - even if they were bound as positional arguments (which cannot be reinserted at call time)~~
- at the original position! - even if there are more positional parameters behind them (which means that default values will be bound to the wrong parameters in the decorated function)
- bound position arguments effectively become keyword-only arguments. This is (1) a concept which is not natively supported in python2 and (2) not reflected in the value of param.kind, so it can't be handled by python3 code either.

Example:

```python
>>> from functools import partial
>>> from inspect import signature
>>> def func(a, b):
... pass
>>> for k,v in signature(partial(func, a=1)).parameters.items():
... print('%s: %s=%s' % (v.kind, v.name, v.default) )
POSITIONAL_OR_KEYWORD: a=1
POSITIONAL_OR_KEYWORD: b=
```