Linked Questions
41 questions linked to/from How to get a function name as a string?
4
votes
3
answers
7k
views
Get function name as a string in python [duplicate]
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 ...
8
votes
4
answers
1k
views
How to get the function name as string in Python? [duplicate]
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 '...
2
votes
4
answers
18k
views
Python: How to print dictionary value? [duplicate]
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 = {
...
2
votes
3
answers
3k
views
Return function name in python? [duplicate]
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 ...
0
votes
3
answers
7k
views
Python pass in function as argument, print the function name and results [duplicate]
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):
........
0
votes
1
answer
4k
views
How to find out if variable item contains specific words in Python? [duplicate]
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:
<...
3
votes
4
answers
116
views
Use variable as functionname and string [duplicate]
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 ...
3
votes
2
answers
171
views
Getting an easily readable function name from a function object in python [duplicate]
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)
>>> ...
-2
votes
2
answers
368
views
Get function name to string [duplicate]
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 ...
1
vote
2
answers
300
views
How do I extract the name of a function from within a function in Python? [duplicate]
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:
...
-2
votes
1
answer
487
views
Function at _____ 0x [duplicate]
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&...
1
vote
2
answers
86
views
% and/or format for function string [duplicate]
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 ...
0
votes
3
answers
96
views
How can I get the name of functions dynamically [duplicate]
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()...
0
votes
1
answer
121
views
Is there a way to identify a functions name from within the function? [duplicate]
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 ...
-1
votes
1
answer
78
views
python 3 printing the name of a function [duplicate]
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):
...