[static methods, class methods]
> Both of these are rarely used; I don't think I have ever written a
> class method in live code. I have used staticmethods as a convenient
> way to put a function into a class namespace.
this is someone out of the flow of the current thread now, but i
forgot to me
"Kent Johnson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Thu, Jun 12, 2008 at 7:48 PM, Alan Gauld
<[EMAIL PROTECTED]> wrote:
"Kent Johnson" <[EMAIL PROTECTED]> wrote>
I am still unsure of the difference of static and class methods.
No, that wasn't me, it was Christopher
On Thu, Jun 12, 2008 at 7:48 PM, Alan Gauld <[EMAIL PROTECTED]> wrote:
> "Kent Johnson" <[EMAIL PROTECTED]> wrote>
>
>> I am still unsure of the difference of static and class methods.
No, that wasn't me, it was Christopher Spears.
>
> You are not alone, it is confusing!
>
>> A class method recei
"Kent Johnson" <[EMAIL PROTECTED]> wrote>
I am still unsure of the difference of static and class methods.
You are not alone, it is confusing!
A class method receives the class it was called on as the first
argument. This can be useful with subclasses. A staticmethod doesn't
get a a class
On Wed, Jun 11, 2008 at 12:17 AM, Christopher Spears
<[EMAIL PROTECTED]> wrote:
tcm.foo
> >
>
> According to the author, the result for typing in 'tcm.foo' is
>
> calling class method foo()
> foo() is part of class: TestClassMethod
Try tcm.foo()
tcm.foo without parentheses is the classm
tcm.foo
> >
>
> Did I do something wrong or is this an error on the book's part?
> Intuitively, the answer I received makes more sense to me. I am still unsure
> of the difference of static and class methods. Can someone enlighten me?
hi there,
thanks for picking up the book. there ar
On Tue, June 10, 2008 9:17 pm, Christopher Spears wrote:
> I am reading Wesley Chun's "Core Python Programming" (2nd Edition) and
> have reached the part on static and class methods. I typed in the
> following to demonstrate the difference between the two methods:
>
class TestClassMethod:
I am reading Wesley Chun's "Core Python Programming" (2nd Edition) and have
reached the part on static and class methods. I typed in the following to
demonstrate the difference between the two methods:
>>> class TestClassMethod:
... def foo(cls):
... print 'calling class method fo