On Mon, 13 Mar 2006 17:18:16 +0100 "Martin P. Hellwig" <[EMAIL PROTECTED]> wrote:
> While I was reading PEP 8 I came across this part: > > """ > Function and method arguments > Always use 'self' for the first argument to instance > methods. Always use 'cls' for the first argument to > class methods. > """ > > Now I'm rather new to programming and unfamiliar to some > basic concepts of OOP. However I wrote most of my classes > in the new style way and by this I have always used > 'self' for the first argument of an Instance method, but > now I'm unsure what actually the difference is between an > instance and a class method is and when to use it in which > case. > > Could somebody please enlighten me (a rtfm/wrong newsgroup > is just as welcome of course), preferably in a short code > example? In short, if you don't know what it is, you don't need it. ;-) So far, the only time I've ever encountered this is with the __new__ method, which, being a classmethod, needs "cls" (which gets loaded with the *class* not the *instance*). -- Terry Hancock ([EMAIL PROTECTED]) Anansi Spaceworks http://www.AnansiSpaceworks.com -- http://mail.python.org/mailman/listinfo/python-list