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

Alexander Schmolck a.schmolck at
Wed Mar 14 18:06:40 CET 2007

"dmitrey" <openopt at> 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


More information about the Python-list mailing list