[PYTHON MATRIX-SIG] Naming Conventions And Practical Experience

Konrad HINSEN hinsenk@ere.umontreal.ca
Thu, 8 Feb 1996 17:30:50 -0500


   Konrad wrote:
   > A "everything in methods" strategy won't work, because a module
   > can't define methods for objects implemented in another module.

   Try this:

   class foo:
       def spam(self):
	   print "spam"
   ...

You are right, I should have specified "C module". For Python classes
this is possible, although not a particularly good idea from the point
of view of modularity. Anyway, arrays are implemented in C...

A possible solution would be to require extensions to use a Python
wrapper like UserArray and subclass it before adding new methods. In
addition to the loss of efficiency that this causes, it would also
make our system more complicated for the casual user.

-------------------------------------------------------------------------------
Konrad Hinsen                     | E-Mail: hinsenk@ere.umontreal.ca
Departement de chimie             | Tel.: +1-514-343-6111 ext. 3953
Universite de Montreal            | Fax:  +1-514-343-7586
C.P. 6128, succ. Centre-Ville     | Deutsch/Esperanto/English/Nederlands/
Montreal (QC) H3C 3J7             | Francais (phase experimentale)
-------------------------------------------------------------------------------

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================