Linked Questions

4 votes
3 answers
7k views

Possible Duplicate: How do I get the name of a function or method from within a Python function or method? How to get the function name as string in Python? I have a function named func, I'd ...
rectangletangle's user avatar
8 votes
4 answers
1k views

Possible Duplicate: How to get the function name as string in Python? I know that I can do that : def func_name(): print func_name.__name__ which will return the name of the function as '...
jlengrand's user avatar
  • 12.9k
2 votes
4 answers
18k views

When I execute the code, it print" function aa in 0x0000... "and all. I want it to print aa,a,b,c,d,. Is it possible? Sorry for the stupid question, thanks a lot. def main(): lunch = { ...
Frank Wen's user avatar
2 votes
3 answers
3k views

Doing a math function of the type def. def integral_error(integral,f): ------stufff------- print integral gives something like: '<function simpsons at 0xb7370a74>' is there a way to ...
arynaq's user avatar
  • 6,870
0 votes
3 answers
7k views

If I want to pass a function func1 as argument in another function, but want to return the function name, what shall I do? let say def func1(x): return x**2 def main_function(func1,x): ........
lrh09's user avatar
  • 587
0 votes
1 answer
4k views

I have created the following variable, which captures the function from a Point object I created: j = i.getfunction() print(j) The print(j) outputs something like this whenever it's called: <...
R. Kap's user avatar
  • 629
3 votes
4 answers
116 views

I have the following code import pandas as pd df = pd.DataFrame(columns=['var1', 'var2','var3']) df.loc[0] = [0,1,2] def RS(): x = 123 y = 456 z = 'And some more random shit' return ...
ThierryHerrie's user avatar
3 votes
2 answers
171 views

Trying to get a function name in Python, I would like to achieve something like this: def my_function(): do_something... def get_func_name(function): return magic(function) >>> ...
Juan Carlos Coto's user avatar
-2 votes
2 answers
368 views

I have a script which monitor a directory and call a function with certain arguments. And in this script a open file.log to explain what happened each time there is a new file in the monitored ...
tpayet's user avatar
  • 42
1 vote
2 answers
300 views

Lets say I have a function which I have defined: def command("filename", function, error): For 'function' I can input one of the following two functions: def linear: return x def exponential: ...
user3716416's user avatar
-2 votes
1 answer
487 views

I'm trying to understand why I'm not only getting the func name back when running the code. def smart_divide(func): def inner(a, b): print("I am going to", func, a, "and&...
Jv Jones's user avatar
1 vote
2 answers
86 views

I'm using format to test a function in Python. I would like the output of a function def test(f,k): print "{0}({1})={2}".format(f,k,f(k)) given test(Sqrt,4) to be Sqrt(4)=2 But format is ...
Andrew Marshall's user avatar
0 votes
3 answers
96 views

I can put those about to be executed functions in to functions_results. I get print out the results, but I couldn't get the functions itself name. For example, functions_results = [ schedules()...
user3675188's user avatar
  • 7,489
0 votes
1 answer
121 views

Is there a way to find a functions name from within the function? def some_function(): function_name = ... # some way of retrieving the name 'some_function' print(function_name) The expected ...
Arco Bast's user avatar
  • 3,950
-1 votes
1 answer
78 views

I have accepted the answer to this question by @dtanabe Here is my code def abc(): pass x = abc class label: def __init__(self,fnname): self.lbl = fnname def __repr__(self): ...
David Epstein's user avatar

15 30 50 per page