Konrad HINSEN hinsenk@ere.umontreal.ca
Wed, 3 Apr 1996 13:57:08 -0500

While putting my recent suggestion into an existing application,
I noticed that a somewhat better definition is:

   class _index_expression_class:

       def __getitem__(self, item):
	   if type(item) != type(()):
	       return (item,)
	       return item

   index_expression = _index_expression_class()

This version always returns a tuple, even if the index is a single
number. That makes it easier to write code that strings together index

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