
Hi, getitem operations gets converted into getitem_idx if they are surrounded by try: except IndexError. I'v duplicated that implementation to make setitem work in the same way. A patch is available here: http://hakan.ardoe.net/pypy/setitem.patch Also, I've updated my special_methods implementation to map getitem_idx to the special method __getitem_idx__ and likewise for setitem. Would it be possible to build support for constructs such as: def get(lst,i): return lst[i] try: get([1,2,3],10) excpt IndexError: print "OK" I suppose the convention from getitem to getitem_idx would have to happen during annotation as different callsites are discovered and each conversion would have to force a reflow of the converted operation? Thanx! -- Håkan Ardö
participants (1)
-
Hakan Ardo