Re: static python classes ?

2007-06-20 Thread Bruno Desthuilliers
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

Re: static python classes ?

2007-06-20 Thread Diez B. Roggisch
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

Re: static python classes ?

2007-06-20 Thread Neil Cerutti
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

Re: static python classes ?

2007-06-20 Thread Alex Martelli
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

Re: static python classes ?

2007-06-20 Thread Neil Cerutti
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

Re: static python classes ?

2007-06-20 Thread Neil Cerutti
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

Re: static python classes ?

2007-06-19 Thread google
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

Re: static python classes ?

2007-06-19 Thread google
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 --

Re: static python classes ?

2007-06-19 Thread Carsten Haese
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

Re: static python classes ?

2007-06-19 Thread Ant
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

Re: static python classes ?

2007-06-19 Thread Tom Gur
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 --

Re: static python classes ?

2007-06-19 Thread Ben Finney
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

Re: static python classes ?

2007-06-19 Thread Diez B. Roggisch
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

Re: static python classes ?

2007-06-19 Thread Bjoern Schliessmann
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 --