New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type of UserList instance returns class instead of instance #48576
Comments
from UserList import UserList
lu = UserList()
type(lu) python2.6 prints: <class 'UserList.UserList'> |
That is because UserList is now a new-style class as a result of it Recommend closing as "won't fix" or "invalid". |
Isn't policy to keep old-style classes around for compatibility in 2.x? |
It has been the practice to not switch old-style to new-style just for |
Fair enough. |
but like that there is no way to detect if the object |
>>> import inspect
>>> from UserList import UserList
>>> lu = UserList()
>>> inspect.isclass(UserList)
True
>>> inspect.isclass(lu)
False |
but for a user define class we have:
where for the UserList instance the comparison with it is just not homogenous. and it make the comparison with are you sure this is not breaking the API ? |
What good is a comparison with InstanceType for? If you want to check |
but in python 2.5 you may do this: if type(lInstance) == types.InstanceType:
...
else:
... and I don't see an easy way to do this with python 2.6 |
I repeat, what is this "easy" condition good for? |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: