Indexing cells in a table

jb egrossde at yahoo.de
Thu May 2 02:49:32 EDT 2002


Alex Martelli wrote:

> def setValues(T, (minI, minJ), (maxI, maxJ), **attributes):
>     for i in range(minI, maxI+1):
>         for j in range(minJ, maxJ+1):
>             for attName in attributes:
>                 attValue = attributes[attName]
>                 setattr(T[i][j], attName, attValue)
> 
> Note that this latter syntax easily allows setting multiple attributes:
> just call, e.g., setValues(T, (1,1), (2,3), a=12, b=34, c=56) should
> you ever need that.  You pay little for the generality, and get a
> rather pretty calling-syntax too.

This last one is very nice, thx.

-- 
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