[EMAIL PROTECTED] wrote:
> Thank you but your advice doesn't fit in my case since I want to keep
> the memory usage and the initial time minimum. iterable[::-1] would
> build another list and it would take big memory and time during
> reversing if iterable were huge. (and the "iterable" wouldn't be
> garbage-collected because I want to keep a reference to it)
You need to implement __iter__ method to pass your assert statement:
def __iter__(self):
return reversed(self)
With regards to style guide:
1. write empty subclass
class rev_subclass(list):
pass
2. print dir(rev_subclass) and write unit tests for every method. There
are 41 of them :) There is also __doc__ attribute you need to override.
3. Implement all the methods of rev_subclass to pass the tests.
Serge.
--
http://mail.python.org/mailman/listinfo/python-list