[Python-Dev] Class Methods

Andrew Dalke dalke at acm.org
Sat Apr 21 18:46:24 EDT 2001


M.-A. Lemburg wrote:
>Here's something to start the fight ;-) ...
>
>1) What would you do with class methods that you cannot do with
>   e.g. globals and functions ?

One of the things I like about C++ is that it offers the
ability to define your memory allocator for a class.  This
came in very handy for a system I wrote which used shared
memory to pass data structures in a master/slave control
struture.

I am not proposing that this be added to Python.  I've only
needed such a feature once in the last 6 years.  I instead
mention it as something which is better done with class
methods than with globals and functions.

I believe this is the only thing in C++ which is
class-function-like, but it's been a while since I got into
the details of C++.

                    Andrew
                    dalke at acm.org






More information about the Python-list mailing list