Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!hq-usenetpeers.eweka.nl!81.171.88.15.MISMATCH!eweka.nl!lightspeed.eweka.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'syntax': 0.03; 'supported,': 0.07; 'python': 0.09; 'sep': 0.09; 'code?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'happily': 0.16; 'new-style': 0.16; 'old-style': 0.16; 'subclassing': 0.16; 'subject:class': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'widely': 0.17; 'class.': 0.23; 'header:In-Reply- To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'implicitly': 0.29; 'class': 0.29; 'classes': 0.30; "aren't": 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'subject:?': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'header:Received:5': 0.40; '26,': 0.65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=xGe30CwPjTl2W86sLWEmpy3qkadIQ642OAdEfnJwAPg=; b=bTJUz+FLDa317r+9kXiDs03lxytnvoawCKdkllTKwuSfECJCBtvvfD2cPDXKFXMaCB 5d1bVndLU+zC1mpVCcWxbINoWQ8V8QSGvUGLRH9RI+3h/QjuE5ijNDRa/EAEYFdI83D8 UX3Skw57VQHS9Vmuf6xwhKV2tRN6SRCx7aB9LhJbplE07vXgl4xlUTcdJ9n04U9TE/qi lZpj6BkKLQ09g3NaQCX4armAfXAnwbsuWYkM/+OU7lO8xo/qwMKzJw47UPO+d1khTNEx SRTovt3GF9nee9IpctVE5tR9kscYmOpQLLKpr8QskgvpeB52D2CKe7NalSPUFTH6zZfE nV6g== MIME-Version: 1.0 In-Reply-To: <2e8a9e88-9e7e-43f7-a070-ea9054e625f2@googlegroups.com> References: <2e8a9e88-9e7e-43f7-a070-ea9054e625f2@googlegroups.com> Date: Wed, 26 Sep 2012 01:05:23 +1000 Subject: Re: new-style class or old-style class? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 10 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348585527 news.xs4all.nl 6965 [2001:888:2000:d::a6]:51245 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30097 On Wed, Sep 26, 2012 at 12:44 AM, Jayden wrote: > In learning Python, I found there are two types of classes? Which one are widely used in new Python code? Is the new-style much better than old-style? Thanks!! Definitely go with new-style. In Python 3, old-style classes aren't supported, and the syntax that would create an old-style class in Python 2 will implicitly create a new-style class. (Explicitly subclassing object still works in Py3, so you can happily use that syntax for both.) ChrisA