implementing module functions==object methods in extension

Harald Kirsch kirschh at lionbioscience.com
Tue May 8 10:54:48 CEST 2001


"Steve  Holden" <sholden at holdenweb.com> writes:

> "Harald Kirsch" <kirschh at lionbioscience.com> wrote ...
> >
> > In the python-2.0 distribution I find that string.join() seems to be
> > implemented as
> >
> > def string.join(words, sep = ' '):
> >   return sep.join(words)
> >
> > I wonder if this is mostly historical or if it is still the preferred
> > way to allow object methods to be called as module functions. I would
> > rather have expected a pure C solution. Consider for example an object
> > method with one integer parameter:
> >
> I'm guessing this was introduced for 2.0 (or maybe 1.6): since the string
> method is coded in C it hardly seems worthwhile to duplicate that code for
> the string module, right?
> 
> [Ferkles about in 1.5.2 library's string module]...

a) I was talking about 2.0.
b) It was anyway my code and *not* what I find in the distribution.
c) The sole purpose of the example code shown was to demonstrate
that duplication is *not* necessary.

Well, in fact I was interested in what was wrong with my proposed C
code. 

Thanks anyway,
  Harald Kirsch

-- 
----------------+------------------------------------------------------
Harald Kirsch   | kirschh at lionbioscience.com | "How old is the epsilon?"
LION bioscience | +49 6221 4038 172          |        -- Paul Erdös
       *** Please do not send me copies of your posts. ***



More information about the Python-list mailing list