Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.python Subject: Re: Classes - converting external function to class's method. Date: Mon, 15 Dec 2014 01:32:52 +0100 Organization: solani.org Lines: 42 Message-ID: <3517223.7xnpL0NDtR@PointedEars.de> References: <2082416.uXDKvNnAXg@PointedEars.de> Reply-To: usenet@PointedEars.de Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1418603573 10850 eJwNysEBwCAIA8CVNEAo42gq+4+g77swTiqdQY+Orpb1knQ64FHVHPAB7HdwcutHTa40//joAifZEKg= (15 Dec 2014 00:32:53 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Mon, 15 Dec 2014 00:32:53 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwFwYEBwCAIA7CXptCi5wCV/09YAuNihxN0DGYkepuOEtvl+JJ4K3ZFpirtfn0Pnz3p3LSYUEHqig1U/3XKFrc= Cancel-Lock: sha1:oatRQ3RlVR27Zvlo+h1zacc2F2I= X-NNTP-Posting-Host: eJwFwQkBwCAMA0BL/ZIwOVBW/xK4Q9LZKoKFwRiUoV7yz7SxbtGPdUYJed0TYIys/p7axx7wJw/V Xref: csiph.com comp.lang.python:82537 Terry Reedy wrote: > On 12/14/2014 6:15 PM, Thomas 'PointedEars' Lahn wrote: >> Ivan Evstegneev wrote: >>> I have stuck a bit with this example(took this one from the book). >>> >>> Here are a description steps of what I've done till now: >>> >>> Step 1 - creating an empty namespace: >>> >>>>>> class rec: pass >> >> IMHO that is not actually creating a namespace; it is just >> declaring/defining an empty class. > > I pythonland, a namespace is a many to one mapping between names and > objects. They are usually but not necessarily implemented with dicts. > […] > >> BTW, the recommended Python 3.x way is >> >> class Rec (object): >> pass > > I hope you meant Python *2*.x, I did not. > where '(object)' *is* needed to make a newstyle class. In 3.x, '(object)' > is optional and normally omitted except in code meant to run unchanged in > 2 and 3. Your statements are corroborated by the Language Reference: Thanks. -- PointedEars