argument type
Alex Martelli
aleaxit at yahoo.com
Tue Dec 28 02:54:56 EST 2004
Steven Bethard <steven.bethard at gmail.com> wrote:
> below). I personally prefer the latter because it seems much more
> likely that users will define alternate collection classes than that
> users will define alternate string classes. My code would look like:
>
> def abc(arg1, arg2, arg3):
> if not isinstance(arg2, basestring):
Moreover, if the user DID define alternate string classes, they really
_should_ inherit basestring. basestring is a 'flag' class -- it doesn't
give any functionality nor impose any burden -- all it exists for is to
support this kind of isinstance usage.
Alex
More information about the Python-list
mailing list