The right check here is `if isinstance(name_or_coord, basestring):`, which covers both these cases and also uses `isinstance`, which is preferred to checking type identity because it allows for subclass objects.