Re: Unification of Methods and Functions
From: Neil Benn (benn_at_cenix-bioscience.com)
Date: 05/25/04
- Next message: calfdog_at_yahoo.com: "Re: MSIE6 Python Question"
- Previous message: David Stockwell: "Re: how to terminate a process on win32?"
- In reply to: David MacQuigg: "Re: Unification of Methods and Functions"
- Next in thread: Greg Ewing: "Re: Unification of Methods and Functions"
- Reply: Greg Ewing: "Re: Unification of Methods and Functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 25 May 2004 13:21:05 +0200 To: python-list@python.org
David MacQuigg wrote:
>On Tue, 25 May 2004 15:31:49 +1200, Greg Ewing
><greg@cosc.canterbury.ac.nz> wrote:
>
>
>
>>David MacQuigg wrote:
>>
>>
>>>My perspective may be different, because I have not yet absorbed the
>>>Python traditions, and I don't have any instictive avoidance of static
>>>methods.
>>>
>>><snip>
>>>
>>>
>>But Python has modules for use as general-purpose
>>namespaces. Classes are thus relieved of the burden
>>of performing this double duty, leaving them free to
>>concentrate on what they do best, which is defining
>>the behaviour of a collection of objects.
>>
>>
<snip>
The point is that a static method defined in a class _is_ a part of the
object model. There are many, many object models where you would have a
static method that _belongs_ to the class.
For a dummy example :
--
A dodo class which has a method to return a new dodo when it is born.
A dodo class with a static method to return the first ever dodo (the
uber-dodo!), this is a static method - making the constructor return the
same dodo each time is counter intuitive.
ALSO
A dodo class static method of Dodo.makeExtinct(), this applies to the
Dodo class (species) and not to the individual dodo (animal).
--
In addition, when returning a singleton, that should live in with
the class as the fact that a class in only available as a singleton is a
factor of the design of the class and should not be linked to another
namespace.
I am a ex-Java/.NET programmer so I admit I'm biased but the problem
is not language specific, it's design specific. I do understand that in
Python this is only syntatic sugar but using a module namespace to
acheive these needs removes what is a link in the design.
Cheers,
Neil
--
Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 46
D-01307
Dresden
Germany
Tel : +49 (0)351 4173 154
e-mail : benn@cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com
- Next message: calfdog_at_yahoo.com: "Re: MSIE6 Python Question"
- Previous message: David Stockwell: "Re: how to terminate a process on win32?"
- In reply to: David MacQuigg: "Re: Unification of Methods and Functions"
- Next in thread: Greg Ewing: "Re: Unification of Methods and Functions"
- Reply: Greg Ewing: "Re: Unification of Methods and Functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|