d. And I cannot handle all cases the same.
If I provided my sort method for my class in Python, wouldn't this call my
__getitem__ and __setitem__ methods (considering l[i] = j assignment do)? Can
this be considered an in consitency?
--
Michalis Giannakidis
--
http://mail.python.org/mailman/listinfo/python-list
d is there a mechanism in Python that will allow me to override the
operators of a class, for all its occurrences, even the ones implemented on C
built-in objects?
--
Michalis Giannakidis
--
http://mail.python.org/mailman/listinfo/python-list
iter__(self, x):
print 'iter:', x
return list.__iter__(self, x)
l = L()
l.append(3) # this does not call my __setitem__
l.append(2)
l.append(1)
l[2] = 6 # this calls my __setitem__
l.sort(key=lambda x: x )
print l
--
Michalis Giannakidis
--
http://mail.python.org/mailman/listinfo/python-list
tation of sorting
from C in mind.
Could someone please explain the reasoning/behabiour of these?
Python Version:
Python 2.4.2 (#1, May 26 2006, 14:35:35)
[GCC 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)] on linux2
Thank you very much in advance.
Michalis
--
Michalis Giannakidis
--
http://mail.python.org/mailman/listinfo/python-list