Indexing cells in a table

jb egrossde at yahoo.de
Sun Apr 28 04:04:31 EDT 2002


I have a base class x with attributes a,b,c,..., that is x.a=0 is o.k.

Now T is a rectangular table of elements of the type x, that is I can say
T[4][3].c=1.

Is there a generic way to address an area of the table and assign values to 
one of the attributes in the area?
That is, can I write a generic function setValue that works like 

T.setValue( (0,0) ,(m,n) , c , 1 ) 

and assigns the value 1 to the x.c-s in the specified area.

Example:

  setValue( (1,1), (2,3), c, 1)

is the same as

  T[1][1].c=1
  T[1][2].c=1
  ...
  T[2][3].c=1

TIA,

-- 
Janos Blazi


-----------== Posted via Newsfeeds.Com - Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Ulimited Fast Downloads - 19 Servers =-----



More information about the Python-list mailing list