Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-09 Thread Michele Simionato
Colin: > It seems to me that __new__ should probably be deprecated for mutable > classes. Certainly not! It is useful for mutable classes too. One just must be careful. Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-09 Thread Colin J. Williams
Michele Simionato wrote: It would be good to have a clear exposition of the pros and cons of __new__ usage. It is there mostly because __init__ would not work on immutable types. OTOH, you probably do not want to use __new__ on mutable types (once I was caught by this trap, google for "overriding

Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-08 Thread Michele Simionato
> It would be good to have a clear exposition of the pros and cons of > __new__ usage. It is there mostly because __init__ would not work on immutable types. OTOH, you probably do not want to use __new__ on mutable types (once I was caught by this trap, google for "overriding list.__new__" if you

Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-08 Thread Colin J. Williams
Brian van den Broek wrote: Daniel Bickett said unto the world upon 2005-02-05 19:46: I was reading the "Pickling and inheritance are making me hurt" thread, and the latest suggestion (as of this posting) was to do with the __setstate__ and __getstate__ methods. They caught my attention

Re: Pickling and inheritance are making me hurt

2005-02-05 Thread Tim Peters
[Kirk Strauser] > I have a module that defines a Search class and a SearchResult class. Try posting a minimal self-contained code sample that fails. > I use these classes by writing other modules that subclass both of them as > needed to interface with particular search engines. > > My problem i

Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-05 Thread Daniel Bickett
Bruno Desthuilliers wrote: > Well, the fact is that __[get|set]state__() have nothing to do with new > style classes, but with the Pickle protocol: > http://www.python.org/doc/2.3.4/lib/pickle-inst.html Thank you for pointing that out, but all the same ;) -- Daniel Bickett dbickett at gmail.com

Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-05 Thread Brian van den Broek
Daniel Bickett said unto the world upon 2005-02-05 19:46: I was reading the "Pickling and inheritance are making me hurt" thread, and the latest suggestion (as of this posting) was to do with the __setstate__ and __getstate__ methods. They caught my attention because I hadn't e

Re: Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-05 Thread Bruno Desthuilliers
Daniel Bickett a écrit : I was reading the "Pickling and inheritance are making me hurt" thread, and the latest suggestion (as of this posting) was to do with the __setstate__ and __getstate__ methods. They caught my attention because I hadn't encountered them before, and it remi

Definitive documentation on newstyle classes? (WAS: Pickling and inheritance are making me hurt)

2005-02-05 Thread Daniel Bickett
I was reading the "Pickling and inheritance are making me hurt" thread, and the latest suggestion (as of this posting) was to do with the __setstate__ and __getstate__ methods. They caught my attention because I hadn't encountered them before, and it reminded me that in the past

Re: Pickling and inheritance are making me hurt

2005-02-05 Thread John J. Lee
Kirk Strauser <[EMAIL PROTECTED]> writes: > I have a module that defines a Search class and a SearchResult class. I use > these classes by writing other modules that subclass both of them as needed > to interface with particular search engines. > > My problem is that Search defines a method (cal

Re: Pickling and inheritance are making me hurt

2005-02-04 Thread Christian Dieterich
On Dé hAoine, Feabh 4, 2005, at 15:48 America/Chicago, Kirk Strauser wrote: I have a module that defines a Search class and a SearchResult class. I use these classes by writing other modules that subclass both of them as needed to interface with particular search engines. My problem is that S

Pickling and inheritance are making me hurt

2005-02-04 Thread Kirk Strauser
I have a module that defines a Search class and a SearchResult class. I use these classes by writing other modules that subclass both of them as needed to interface with particular search engines. My problem is that Search defines a method (called automatically by __del__) to save its results bet