Python equivalents to MATLAB str2func, func2str, ischar, isfunc?

2007-03-14 Thread dmitrey
I can't find these via web serch thank you in advance, Dmitrey -- http://mail.python.org/mailman/listinfo/python-list

Re: Python equivalents to MATLAB str2func, func2str, ischar, isfunc?

2007-03-14 Thread Alexander Schmolck
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 --

Re: Python equivalents to MATLAB str2func, func2str, ischar, isfunc?

2007-03-14 Thread Travis Oliphant
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

Re: Python equivalents to MATLAB str2func, func2str, ischar, isfunc?

2007-03-14 Thread dmitrey
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 =

Re: Python equivalents to MATLAB str2func, func2str, ischar, isfunc?

2007-03-14 Thread Alexander Schmolck
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