Antoine Pitrou <[EMAIL PROTECTED]> added the comment:

Hi,

Le mercredi 02 juillet 2008 à 20:43 +0000, Aaron Gallagher a écrit :
> Aaron Gallagher <[EMAIL PROTECTED]> added the comment:
> 
> Ah, I didn't know that a list would be as fast for appending and popping. 
> I knew that lists were optimized for .append() and .pop(), but I didn't 
> know that a list would be just as fast as a deque if it was just used as a 
> stack.

If you have a few minutes to spare, the best would be to measure the
speed of both possibilities, and opt for the fastest. 

> And I'll be happy to write unit tests if it can be pointed out to me how 
> exactly they can be written. Should it just test to make sure pickling a 
> deeply nested object hierarchy can be pickled without raising a 
> RuntimeError?

Yes, exactly. Just create a very deeply nested object (a list should be
sufficient I suppose), pickle it, unpickle it, and check that the result
is equal to the original. No need to do more. Don't bother catching the
eventual RuntimeError, if it is raised the test will be failed anyway.

Since your patch only regards the pickle module (not cPickle) I suppose
the test could go directly into Lib/test/test_pickle.py.

(oh and don't forget to check the test case fails without your
patch :-))

Thanks !

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3119>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to