[Python-projects] * has no '__class__' member
MATSUI Tetsushi
VED03370 at nifty.ne.jp
Fri Jul 7 21:34:27 CEST 2006
Hello,
I found pylint complains about the __class__ attribute for many
built-in types.
Here is a dull example code runs without an error:
print (1).__class__
print (1L).__class__
print "1".__class__
print object.__class__
print object().__class__
class Empty (object):
"an empty class"
print Empty.__class__
print Empty().__class__
The result of the above:
<type 'int'>
<type 'long'>
<type 'str'>
<type 'type'>
<type 'object'>
<type 'type'>
<class '__main__.Empty'>
pylint complains 5 times about __class__ out of 7:
E: 1: Instance of 'int' has no '__class__' member
E: 2: Instance of 'long' has no '__class__' member
E: 3: Instance of 'str' has no '__class__' member
E: 4: Class 'object' has no '__class__' member
E: 10: Class 'Empty' has no '__class__' member
I hope this behavior be fixed.
Only old style classes have no __class__ members as far as I tried.
For example:
class OldStyle:
pass
OldStyle.__class__
fails with an AttributeError.
Thanks.
--
MATSUI Fe2+ Tetsushi
http://homepage3.nifty.com/text/
(http://lowlife.jp/mft/ for blog)
More information about the Python-Projects
mailing list