homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author thread13
Recipients benjamin.peterson, georg.brandl, thread13
Date 2012年04月27日.02:58:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1335495526.15.0.298160882509.issue14671@psf.upfronthosting.co.za>
In-reply-to
Content
I do not mean to reopen the bug (there are supposedly much more important things to work on in Python). 
But just for the record, let me state that I feel like there is some misleading inconsistency here:
- by definition, a new style class is "Any class which inherits from object" ( see http://docs.python.org/glossary.html#term-new-style-class ) ;
- to support this statement, new classes are indeed explicitly defined in the form "NewClass(object)" ;
- now isinstance(), that is supposed to "return whether an object is an instance of a class or of a subclass thereof" (see help(isinstance)), returns True for old-style objects.
It also seems reasonable if the descendants of a class will inherit its powers, which -- in the case of the old-style classes -- they obviously don't.
Furthermore, I personally see no /point/ in returning True for isinstance(Old(), object): as it is quite misleading, one could easily have made it returning e.g. None as well.
As I completely accept the fact it's a feature -- ( may be slightly confusing, and probably also useless -- but ... hey, nobody's perfect ) -- should I take then calling
issubclass(obj.__class__, object) 
to be the official way to distinguish between the new-style and the old-style classes?
History
Date User Action Args
2012年04月27日 02:58:46thread13setrecipients: + thread13, georg.brandl, benjamin.peterson
2012年04月27日 02:58:46thread13setmessageid: <1335495526.15.0.298160882509.issue14671@psf.upfronthosting.co.za>
2012年04月27日 02:58:42thread13linkissue14671 messages
2012年04月27日 02:58:41thread13create

AltStyle によって変換されたページ (->オリジナル) /