difference between class and static methods?
John Salerno
johnjsal at NOSPAMgmail.com
Tue Apr 18 17:08:46 EDT 2006
Marc 'BlackJack' Rintsch wrote:
> If you call `B.from_file('spam.xyz')` now, the `from_file()` method
> inherited from class `A` is called but with `B` as the first argument so
> it returns an instance of `B`.
>
> A staticmethod is just a function attached to a class without any "magic".
So a class method is specifically for using the class name itself as an
object in the method? If that's the case, then it makes some sense now.
I guess the reason I didn't get it before is that this is a feature of
dynamic languages, right? And something that couldn't have been done in
C# anyway?
More information about the Python-list
mailing list