H
Hans Georg Krauthaeuser
Dear all,
I have a problem to get the command that has called a function if the
command was given on multiple lines. E.g.:
###################################################
import inspect
def call(a,b,c,d,e):
s = inspector()
return s
def inspector():
frame = inspect.currentframe()
outerframes = inspect.getouterframes(frame)
cmd = ''
for c in outerframes[2][4]:
cmd += c
return cmd
if __name__ == '__main__':
s1 = call (1,2,3,4,5)
s2 = call (1,\
2,\
3,\
4,\
5)
print '-'*10
print s1
print '-'*10
print s2
print '-'*10
###################################################
This gives the output:
----------
s1 = call (1,2,3,4,5)
----------
5)
----------
I'm quite new to python and the standard libs. So forgive me, if this is
a stupid question.
Any help is very much appreciated.
Best regards
Hans Georg
I have a problem to get the command that has called a function if the
command was given on multiple lines. E.g.:
###################################################
import inspect
def call(a,b,c,d,e):
s = inspector()
return s
def inspector():
frame = inspect.currentframe()
outerframes = inspect.getouterframes(frame)
cmd = ''
for c in outerframes[2][4]:
cmd += c
return cmd
if __name__ == '__main__':
s1 = call (1,2,3,4,5)
s2 = call (1,\
2,\
3,\
4,\
5)
print '-'*10
print s1
print '-'*10
print s2
print '-'*10
###################################################
This gives the output:
----------
s1 = call (1,2,3,4,5)
----------
5)
----------
I'm quite new to python and the standard libs. So forgive me, if this is
a stupid question.
Any help is very much appreciated.
Best regards
Hans Georg