Giter Club home page Giter Club logo

dynarg's People

Contributors

vminasid avatar

Watchers

 avatar  avatar

dynarg's Issues

nested dynarg

  • dynarg version: 0.1.0
  • Python version: 2.7
  • Operating System: Ubuntu 14.04

Description

Wrapping a function with dynarg removes all of its argument names:

dynarg(f(x1, x2), {'x1':0}) = f_dynarg(*args)

What I Did

@dynarg_decor({'a':10}, verbose=True)
def add(a, b, c):
return a + b + c

print add(5, 1)

decor = dynarg(add, {'b':10}, verbose=True)
print decor(5)

What I got

/usr/bin/python2.7 /home/noitapicname/pycharmprojects/dynarg/dynarg/dynarg.py
Traceback (most recent call last):
decorator received function 'add'
File "/home/noitapicname/pycharmprojects/dynarg/dynarg/dynarg.py", line 53, in
with local variables: ('a', 'b', 'c')
print decor(5)
and arguments: ['a', 'b', 'c']
Fixed arguments: [('a', 10)]
New input arguments for 'add': ['b', 'c']
File "/home/noitapicname/pycharmprojects/dynarg/dynarg/dynarg.py", line 36, in wrapper
{'c': 1, 'b': 5}
return function(**all_variables)
TypeError: wrapper() got an unexpected keyword argument 'b'
16
decorator received function 'add_dynarg'
with local variables: ('dynamic_vars_vals', 'dynamic_vars_dict', 'all_variables')
and arguments: []
Fixed arguments: [('b', 10)]
New input arguments for 'add_dynarg': []
{}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.