Linked Questions

-1 votes
3 answers
7k views

In the following code how to make the unicode data callable.The error that i get is //TypeError: 'unicode' object is not callable def test(test_config): for i in test_config: print i....
Rajeev's user avatar
  • 47.3k
0 votes
5 answers
365 views

Im writing a python script and what I would like to do is capture the input into a variable and then use that to call a function with that name. Here is an example: def test(): print "You want to ...
stevo81989's user avatar
0 votes
2 answers
173 views

if I have a string like 'module.function', How can I execute function just by one step? likesomefunction('os.error','args')
ssj's user avatar
  • 1,817
1 vote
1 answer
70 views

I have two inherited classes in a module shape.py : class Shape(object): class Triangle(Shape): class Square(Shape): In my main code I want to instantiate a Shape but I don't know what kind of ...
Jpaille's user avatar
  • 123
0 votes
0 answers
36 views

I have a facebook messenger chatbot I programmed in python. There are a few dozen commands it handles, mostly via a ton of if/then statements as follows if state == "state1": if "command1" in ...
quantumbutterfly's user avatar
2 votes
4 answers
3k views

I have a generic smoothing function, and based on a configuration file (yaml which will be loaded as a dictionary), different implementation (boxcar or gaussian) will be called. These implementations ...
Dzung Nguyen's user avatar
  • 3,954
0 votes
3 answers
2k views

I've referred to the following threads and I don't think that this post is a duplicate of any of them: Calling a function of a module by using its name (a string) Python Call Function from String Use ...
ytu's user avatar
  • 1,840
1 vote
3 answers
4k views

My question is some how related to this question, I have a dictionary of functions with a different number of arguments, how can I call them in an automatic way? funcdict = { 'mypackage.mymodule1....
Am1rr3zA's user avatar
  • 7,461
1 vote
2 answers
133 views

First of all to find "lcm" of two numbers I made a function lcm(a, b). Then I thought of finding "hcf" too so I made a decorator decor and defined a function hcf(a, b) in it. And then I returned this ...
Pardeep Singh Brar's user avatar
-1 votes
3 answers
391 views

I'm relatively new to c++, mostly worked with python. I have a scenario where a user(me) uses a GUI to send commands to a microcontroller via serial, and then the microcontroller processes them. Right ...
Wscott's user avatar
  • 3
0 votes
2 answers
131 views

How to call a function when it's name is stored in a string, has already been answered. What I want to know is how do I do this if the function I'm wanting to call is defined in my local scope. This ...
Michael Wiles's user avatar
-2 votes
3 answers
68 views

Basically, I have a lot of functions that have a similar name (p1(), p2(), p3(), ..., p20()) and I don't want to call them all by hand. I want to do something like this: for i in range(1, 21): p{...
zeleninka_5's user avatar
0 votes
1 answer
32 views

If I make a function call check('list') and in the function that I'm defining, which is called check, I want to use if isinstance(value, x): where x is the argument of check, currently 'list' but it ...
Cheese's user avatar
  • 441