On Mon, Nov 26, 2012 at 3:01 PM, Chris Jerdonek <chris.jerdonek at gmail.com>wrote: > I would like to know when we should use "class" in the Python 3 > documentation, and when we should use "type." Are these terms > synonymous in Python 3, and do we have a preference for which to use > and when? > > I'm sure this has been discussed before. But if this terminology > issue has already been resolved, the resolution doesn't seem to be > reflected in the docs. For example, the glossary entries for type and > class don't reference each other. > The historical distinction between "builtin types" and "user-defined classes" predates new-style classes (which unified the type system) and Python 3 (which eliminated the "instance" type that was provided to preserve the legacy user-defined class semantics in Python 2). The glossary unfortunately still reflects this distinction, which no longer exists in Python 3. A slightly more useful distinction would be if type was used consistently to refer to type(x), while class was used to refer to x.__class__, since they can and do differ in the case of proxy types (like weakref.proxy). However, it's probably too late for that kind of fine distinction - in reality, the two terms are now used pretty much interchangeably. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20121126/7ee8f491/attachment.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4