"indexed properties"...

pataphor pataphor at gmail.com
Sun May 18 02:50:23 EDT 2008


In article <hjlt245hnhrle11khpupg6fppr000f8f51 at 4ax.com>, 
dullrich at sprynet.com says...

> >>   window.pos = (x,y)
> >>
> >> seems more natural than
> >>
> >>   window.SetPos(x,y);

Yes, and to assign a row in a matrix I'd also like to use either tuples 
or lists on the right side. 

>   def __add__(self, other):
>     return Row([x + y for x, y in zip(self, other)])
> 
> worked as hoped if self is a Row and other is a
> Row _or_ a list.)
> 
> Anyway, my m.rows[j] can't be a list, because
> I want to be able to say things like
> m.rows[0] += c*m.rows[2]. Allowing 
> m.rows[j] = [1,2,3] seems convenient, while
> requiring m.rows[j] = Row([1,2,3]) fixes
> this problem. Hmm.

I'm not sure how far you'd go along with Gabriel's idea of decoupling 
views from data but I think there isn't even a need for using a matrix 
as the underlying data type. Why not use a flat list and compute matrix 
positions according to a row or column adressing scheme on the fly? 

P.




More information about the Python-list mailing list