[issue4326] type of UserList instance returns class instead of instance

2008-11-18 Thread Georg Brandl
Georg Brandl [EMAIL PROTECTED] added the comment: I repeat, what is this easy condition good for? ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4326 ___ ___

[issue4326] type of UserList instance returns class instead of instance

2008-11-17 Thread chafporte
chafporte [EMAIL PROTECTED] added the comment: 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 (feel free to propose a solution if you have one) ___

[issue4326] type of UserList instance returns class instead of instance

2008-11-15 Thread Georg Brandl
Georg Brandl [EMAIL PROTECTED] added the comment: What good is a comparison with InstanceType for? If you want to check whether it's an instance of a custom class, you'll have to check for instances of new-style classes anyway. If you want to check for UserList instances, use isinstance().

[issue4326] type of UserList instance returns class instead of instance

2008-11-14 Thread chafporte
New submission from chafporte [EMAIL PROTECTED]: from UserList import UserList lu = UserList() type(lu) python2.6 prints: class 'UserList.UserList' python2.5 prints: type 'instance' -- components: None messages: 75885 nosy: chafporte severity: normal status: open title: type of

[issue4326] type of UserList instance returns class instead of instance

2008-11-14 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: That is because UserList is now a new-style class as a result of it inheriting from the new abstract base classes. I believe this is the way Guido wanted it and do not see any deleterious impacts from the change. Recommend closing as won't

[issue4326] type of UserList instance returns class instead of instance

2008-11-14 Thread Benjamin Peterson
Benjamin Peterson [EMAIL PROTECTED] added the comment: Isn't policy to keep old-style classes around for compatibility in 2.x? Especially one like UserList which is meant to be used as a base class. -- nosy: +benjamin.peterson ___ Python tracker

[issue4326] type of UserList instance returns class instead of instance

2008-11-14 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: It has been the practice to not switch old-style to new-style just for the hell of it. However, we do switch as part of large PEP driven efforts like the ABC backport. ___ Python tracker [EMAIL

[issue4326] type of UserList instance returns class instead of instance

2008-11-14 Thread Benjamin Peterson
Benjamin Peterson [EMAIL PROTECTED] added the comment: Fair enough. -- resolution: - wont fix status: open - closed ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4326 ___

[issue4326] type of UserList instance returns class instead of instance

2008-11-14 Thread chafporte
chafporte [EMAIL PROTECTED] added the comment: but like that there is no way to detect if the object is a class or an instance. type() says it's a class in both case ! ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4326

[issue4326] type of UserList instance returns class instead of instance

2008-11-14 Thread Raymond Hettinger
Raymond Hettinger [EMAIL PROTECTED] added the comment: import inspect from UserList import UserList lu = UserList() inspect.isclass(UserList) True inspect.isclass(lu) False ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue4326

[issue4326] type of UserList instance returns class instead of instance

2008-11-14 Thread chafporte
chafporte [EMAIL PROTECTED] added the comment: but for a user define class we have: class AAA: ... pass a = AAA() type(a) type 'instance' and you can compare this with types.InstanceType and it says True where for the UserList instance the comparison with types.InstanceType says False it is