I can't find these via web serch
thank you in advance,
Dmitrey
--
http://mail.python.org/mailman/listinfo/python-list
dmitrey [EMAIL PROTECTED] writes:
I can't find these via web serch
thank you in advance,
Dmitrey
str2func: getattr(some_module, 'f')
func2str: f.__name__
ischar: isinstance(x, basestring) and len(x) == 1
isfunc: callable(x) # is most likely to be what you want
'as
--
dmitrey wrote:
I can't find these via web serch
You won't find exact equivalents. But, the same functionality is
available. Perhaps you would like to show us what you are trying to do
in Python.
Python's eval has some similarity with str2func
Python's repr() or str() has some similarity
Thank you
(however in MATLAB ischar is the same as isstr)
but what if I don't know the name of module?
I.e. I have
def myfunc(param): ...
#where param can be both funcName or a function, and I want to obtain
both name and func, something like
if isinstance(param, basestring):
func, funcName =
dmitrey [EMAIL PROTECTED] writes:
Thank you
(however in MATLAB ischar is the same as isstr)
Right, sorry.
but what if I don't know the name of module?
I.e. I have
def myfunc(param): ...
#where param can be both funcName or a function, and I want to obtain
both name and func, something