Re: Style guide for subclassing built-in types?

2005-02-24 Thread Just
In article [EMAIL PROTECTED], [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.

Re: Style guide for subclassing built-in types?

2005-02-24 Thread Serge Orlov
[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

Re: Style guide for subclassing built-in types?

2005-02-24 Thread Nick Coghlan
[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

Re: Style guide for subclassing built-in types?

2005-02-23 Thread Fuzzyman
I guess print is using the __repr__ (or __str__ ?) methods of lsit - which you will need to override as well. Regards, Fuzzy http://www.voidspace.org.uk/python/index.shtml -- http://mail.python.org/mailman/listinfo/python-list

Re: Style guide for subclassing built-in types?

2005-02-23 Thread janeaustine50
Fuzzyman wrote: I guess print is using the __repr__ (or __str__ ?) methods of lsit - which you will need to override as well. Regards, Fuzzy http://www.voidspace.org.uk/python/index.shtml Thank you but the problem is that I have to express my intention in duplicate places -- __iter__(along

Re: Style guide for subclassing built-in types?

2005-02-23 Thread Nick Coghlan
[EMAIL PROTECTED] wrote: p.s. the reason I'm not sticking to reversed or even reverse : suppose the size of the list is huge. Reversed is an iterator - it does NOT copy the list. In other words, reversed already does pretty much what you want. Cheers, Nick. -- Nick Coghlan | [EMAIL

Re: Style guide for subclassing built-in types?

2005-02-23 Thread Fuzzyman
[EMAIL PROTECTED] wrote: Fuzzyman wrote: I guess print is using the __repr__ (or __str__ ?) methods of lsit - which you will need to override as well. Regards, Fuzzy http://www.voidspace.org.uk/python/index.shtml Thank you but the problem is that I have to express my intention in

Re: Style guide for subclassing built-in types?

2005-02-23 Thread Kent Johnson
[EMAIL PROTECTED] wrote: p.s. the reason I'm not sticking to reversed or even reverse : suppose the size of the list is huge. reversed() returns an iterator so list size shouldn't be an issue. What problem are you actually trying to solve? Kent --

Re: Style guide for subclassing built-in types?

2005-02-23 Thread janeaustine50
Kent Johnson wrote: [EMAIL PROTECTED] wrote: p.s. the reason I'm not sticking to reversed or even reverse : suppose the size of the list is huge. reversed() returns an iterator so list size shouldn't be an issue. What problem are you actually trying to solve? Kent Oh, you are right.

Re: Style guide for subclassing built-in types?

2005-02-23 Thread Michael Spencer
[EMAIL PROTECTED] wrote: Kent Johnson wrote: [EMAIL PROTECTED] wrote: p.s. the reason I'm not sticking to reversed or even reverse : suppose the size of the list is huge. reversed() returns an iterator so list size shouldn't be an issue. What problem are you actually trying to solve? Kent Oh, you

Re: Style guide for subclassing built-in types?

2005-02-23 Thread janeaustine50
Michael Spencer wrote: [EMAIL PROTECTED] wrote: Kent Johnson wrote: [EMAIL PROTECTED] wrote: p.s. the reason I'm not sticking to reversed or even reverse : suppose the size of the list is huge. reversed() returns an iterator so list size shouldn't be an issue. What problem

Re: Style guide for subclassing built-in types?

2005-02-22 Thread janeaustine50
Jane Austine wrote: Please see the following code: class rev_wrap(object): def __init__(self,l): self.l=l def __getitem__(self,i): return self.l[-i-1] class rev_subclass(list): def __getitem__(self,i): return