[Freeipa-devel] Re: [PATCH] check for both str and unicode types

Felix Schwarz felix.schwarz at web.de
Thu Feb 21 14:52:46 UTC 2008


Robert,

Rob Crittenden wrote:
> +def is_string(value):
> +    """Return True if value is an instance of str or unicode."""
> +    if (isinstance(value, str) or isinstance(value,unicode)):
> +        return True
> +    else:
> +        return False

IMHO you should check for "isinstance(value, basestring)" which does
the right thing (tm).

fs




More information about the Freeipa-devel mailing list