Guido van Rossum wrote:
There's no need to change Python so that people coming from other
languages won't make silly mistakes, is there?
Is that really a mistake... Yes, it's a mistake since staticmethod is a
descriptor, but isn't it in a sense an implementation detail,
particularly for a
Armin Rigo wrote:
Hi Nicolas,
On Thu, Mar 02, 2006 at 01:55:03AM -0500, Nicolas Fleury wrote:
(...) A use case is not hard to
imagine, especially a private static method called only to build a class
attribute.
Uh. I do this all the time, and the answer is simply: don't make that a
On 3/15/06, Nicolas Fleury [EMAIL PROTECTED] wrote:
I think we all agree on this list that there's no point using a
staticmethod for that use case. My suggestion was for some
comp.lang.python people, a lot coming from other languages. Their
reflex would be much more to define a staticmethod.
Hi Nicolas,
On Thu, Mar 02, 2006 at 01:55:03AM -0500, Nicolas Fleury wrote:
(...) A use case is not hard to
imagine, especially a private static method called only to build a class
attribute.
Uh. I do this all the time, and the answer is simply: don't make that a
staticmethod.
On 3/12/06, Armin Rigo [EMAIL PROTECTED] wrote:
Staticmethods are for the rare case where you needdynamic class-based dispatch but don't have an instance around.Actually, I would argue that's what classmethods are for, not staticmethods. You may not envision a desire for having the class in the
Hi,
I've posted this question on comp.lang.python, but nobody seems to
conclude it is a bad idea, so I post it here.
http://groups.google.com/group/comp.lang.python/browse_frm/thread/6082dae1deef9161/88bb8a26750dd8c6?lnk=raothl=en#88bb8a26750dd8c6
Basically, should staticmethods be made
On 3/1/06, Nicolas Fleury [EMAIL PROTECTED] wrote:
Basically, should staticmethods be made callable so that the following
would not raise an exception:
class A:
@staticmethod
def foo(): pass
bar = foo()
There's workarounds, but it's really just about usability.
Steven Bethard wrote:
My only (mild) concern is that if staticmethod is going to get a
__call__, I think classmethod should probably get one too. Inside a
class this doesn't make much sense:
I agree, make sense or not, if @staticmethod def foo() and a simple
def foo(self) can all be called
On 3/1/06, Nicolas Fleury [EMAIL PROTECTED] wrote:
The problem is that even after explaining descriptors (which IMHO can be
a more advanced feature for newbies), you still need a workaround and
you might end up with (or call __get__):
class A:
def foo(): pass
bar = foo()
foo
Guido van Rossum wrote:
In which context did you find a need for defining a static method and
calling it inside the class definition? I'm guessing that what you're
playing dubious scoping games.
I'm not. I almost never use staticmethod actually. I find them not
very pythonic, in my humble
10 matches
Mail list logo