"Huy Ton That" wrote
I was taking a look at the module decimal.py as you cited, and it
makes
sense now. Looks very useful to make tools without having to
instantiate
anything.
Thats not a good way to think of them.
Doing things without instantiating is usually better done by a
function.
Thank you all,
I was taking a look at the module decimal.py as you cited, and it makes
sense now. Looks very useful to make tools without having to instantiate
anything.
On Mon, Sep 13, 2010 at 7:05 AM, Steven D'Aprano wrote:
> On Mon, 13 Sep 2010 12:29:07 pm Huy Ton That wrote:
> > Hm, thanks g
On Mon, 13 Sep 2010 12:29:07 pm Huy Ton That wrote:
> Hm, thanks guys; I just had to verify I was thinking sanely about it.
> I am going to pick up classmethods next. Do any of you have common
> design patterns for the usage. They are just items I haven't
> integrated in my coding, and I want to be
Hm, thanks guys; I just had to verify I was thinking sanely about it. I am
going to pick up classmethods next. Do any of you have common design
patterns for the usage. They are just items I haven't integrated in my
coding, and I want to be certain I'm off on the right foot (:
On Sun, Sep 12, 2010
"Steven D'Aprano" wrote
A little more information... static methods are quite common[1] in
Java
and C++, where people feel the need (or in the case of Java, are
forced
by the language) to make every function a method.
static methods in C++ are normally reserved for use as class
methods (alt
On Mon, 13 Sep 2010 09:13:25 am Steven D'Aprano wrote:
> On Mon, 13 Sep 2010 06:05:23 am Alan Gauld wrote:
> > I think static methjods are largely a mistake of history. ISTR They
> > were
> > introduced into python before class methods (not by much - one
> > release?)
>
> No, they were introduced a
On Mon, 13 Sep 2010 06:05:23 am Alan Gauld wrote:
> I think static methjods are largely a mistake of history. ISTR They
> were
> introduced into python before class methods (not by much - one
> release?)
No, they were introduced at the same time. But it turned out that the
use cases Guido van Ro
"Huy Ton That" wrote
class WhatFor(object):
def it(cls):
print 'work with %s' % cls
it = classmethod(it)
def uncommon():
print 'I could be a global function'
uncommon = staticmethod(uncommon)
But I can't seem to understand the above. Under what circumstance
would
st
On Sat, 11 Sep 2010 12:35:48 am Huy Ton That wrote:
> I am reading the decorator section within Expert Python Programming
> and I am very confused in the first example, of a method that was
> done before decorators. It reads:
>
> class WhatFor(object):
> def it(cls):
> print 'work with
I am reading the decorator section within Expert Python Programming and I am
very confused in the first example, of a method that was done before
decorators. It reads:
class WhatFor(object):
def it(cls):
print 'work with %s' % cls
it = classmethod(it)
def uncommon():
pr
10 matches
Mail list logo