Tom Gur a écrit :
Look for @staticmethod inhttp://docs.python.org/lib/built-in-funcs.html
Example:
class C:
@staticmethod
def f(arg1, arg2, ...): ...
Oops, sorry for the confusion - I've actually meant a static method,
and Gerald's answer works fine.
FWIW, staticmethods in
Bjoern Schliessmann wrote:
Diez B. Roggisch wrote:
With other OOP languages you mean Java. Which does have static
methods because they lack the notion of a function by its own, so
the shoehorned them into their everything is inside a
class-paradigm.
ACK, but doesn't C++ have static
On 2007-06-19, Bjoern Schliessmann
[EMAIL PROTECTED] wrote:
Diez B. Roggisch wrote:
With other OOP languages you mean Java. Which does have static
methods because they lack the notion of a function by its own,
so the shoehorned them into their everything is inside a
class-paradigm.
ACK, but
Neil Cerutti [EMAIL PROTECTED] wrote:
In C++ they are used most often for factory functions, since they
conveniently have access to the class's private members, and
don't want or need an existing instance. Python seems to have
adopted this use-case (ConfigParser, for example), but without a
On 2007-06-20, Alex Martelli [EMAIL PROTECTED] wrote:
Neil Cerutti [EMAIL PROTECTED] wrote:
In C++ they are used most often for factory functions, since they
conveniently have access to the class's private members, and
don't want or need an existing instance. Python seems to have
adopted
On 2007-06-20, Neil Cerutti [EMAIL PROTECTED] wrote:
On 2007-06-20, Alex Martelli [EMAIL PROTECTED] wrote:
Neil Cerutti [EMAIL PROTECTED] wrote:
In C++ they are used most often for factory functions, since
they conveniently have access to the class's private members,
and don't want or need an
On Jun 19, 10:00 pm, Tom Gur [EMAIL PROTECTED] wrote:
Hi,
I'm new to python, and I can't seem to find in the docs how to create
the python equivalent of what's called in most OOP languages static
classes, can you give me a hint ?
Look for @staticmethod in
the python equivalent of what's called in most OOP languages static
classes, can you give me a hint ?
Look for @staticmethod inhttp://docs.python.org/lib/built-in-funcs.html
Woops... I misread...
--
Gerald Kaszuba
http://geraldkaszuba.com
--
On Tue, 2007-06-19 at 12:00 +, Tom Gur wrote:
Hi,
I'm new to python, and I can't seem to find in the docs how to create
the python equivalent of what's called in most OOP languages static
classes, can you give me a hint ?
If I had to guess, which apparently I have to because you're not
It's not clear what you mean here. If you mean something like static
inner classes in Java, then you can simply nest classes in Python:
class A(object):
... class B(object):
... def aaa(self):
... print AA
...
z = A.B()
z.aaa()
AA
(In contrast
Look for @staticmethod inhttp://docs.python.org/lib/built-in-funcs.html
Example:
class C:
@staticmethod
def f(arg1, arg2, ...): ...
Oops, sorry for the confusion - I've actually meant a static method,
and Gerald's answer works fine.
Thanks alot
--
Tom Gur [EMAIL PROTECTED] writes:
I'm new to python, and I can't seem to find in the docs how to
create the python equivalent of what's called in most OOP languages
static classes, can you give me a hint ?
Can you give us a hint of what a static class would do? That is,
what features do you
Tom Gur wrote:
Hi,
I'm new to python, and I can't seem to find in the docs how to create
the python equivalent of what's called in most OOP languages static
classes, can you give me a hint ?
With other OOP languages you mean Java. Which does have static methods
because they lack the notion
Diez B. Roggisch wrote:
With other OOP languages you mean Java. Which does have static
methods because they lack the notion of a function by its own, so
the shoehorned them into their everything is inside a
class-paradigm.
ACK, but doesn't C++ have static methods too?
Regards,
Björn
--
14 matches
Mail list logo