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

Alexander Schmolck a.schmolck at gmail.com
Wed Mar 14 13:06:40 EDT 2007


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



More information about the Python-list mailing list