[pygccxml-development] __getitem__ / __setitem__
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <ba...@ir...> - 2006-09-28 08:42:59
|
Hi, Py++ turns index operators into a __getitem__() method. Now I was just wondering if it should also create a __setitem__() method when there's an operator that returns a reference? I have some cases where this would be desirable (but I don't know if it's desirable in every case). For example, the Maya vector classes define operators like these: double& operator[] ( unsigned i ); double operator[] ( unsigned i ) const; So far, I was ignoring the first one and only wrapped the second one which was correctly turned into a __getitem__() method (but of course, this meant I couldn't assign values via the index operator). In this case, the first operator could actually spawn a __setitem__() method as well. I have no problems with doing that manually, but I was just wondering if this could/should be made an (optional?) builtin functionality of Py++ and so I'm just throwing in the idea... - Matthias - |