Re: [Python-Dev] PEP 389: argparse - new command line parsing module

2009-09-29 Thread Michael Haggerty
Steven Bethard wrote: > On Tue, Sep 29, 2009 at 1:31 PM, Paul Moore wrote: >> 2009/9/28 Yuvgoog Greenle : >>> 1. There is no chance of the script killing itself. In argparse and optparse >>> exit() is called on every parsing error (btw because of this it sucks to >>> debug parse_args in an interpr

Re: [Python-Dev] suggestion for try/except program flow

2009-03-28 Thread Michael Haggerty
Mark Donald wrote: > I frequently have this situation: > > try: > try: > raise Thing > except Thing, e: > # handle Thing exceptions > raise > except: > # handle all exceptions, including Thing This seems like an unusual pattern. Are you sure you can't use try

Re: [Python-Dev] Pickler/Unpickler API clarification

2009-03-07 Thread Michael Haggerty
Guido van Rossum wrote: > On Sat, Mar 7, 2009 at 8:04 AM, Michael Haggerty wrote: >> Typically, the purpose of a database is to persist data across program >> runs. So typically, your suggestion would only help if there were a way >> to persist the primed Pickler across

Re: [Python-Dev] Pickler/Unpickler API clarification

2009-03-07 Thread Michael Haggerty
Greg Ewing wrote: > Michael Haggerty wrote: >> A similar effect could *almost* be obtained without accessing the memos >> by saving the pickled primer itself in the database. The unpickler >> would be primed by using it to load the primer before loading the record >> of

Re: [Python-Dev] Pickler/Unpickler API clarification

2009-03-06 Thread Michael Haggerty
Antoine Pitrou wrote: > Le vendredi 06 mars 2009 à 13:44 +0100, Michael Haggerty a écrit : >> Antoine Pitrou wrote: >>> Michael Haggerty alum.mit.edu> writes: >>>> It is easy to optimize the pickling of instances by giving them >>>> __getstate__()

Re: [Python-Dev] Pickler/Unpickler API clarification

2009-03-06 Thread Michael Haggerty
Antoine Pitrou wrote: > Michael Haggerty alum.mit.edu> writes: >> It is easy to optimize the pickling of instances by giving them >> __getstate__() and __setstate__() methods. But the pickler still >> records the type of each object (essentially, the name of its class)

Re: [Python-Dev] Pickler/Unpickler API clarification

2009-03-06 Thread Michael Haggerty
Collin Winter wrote: > [...] I've found a few examples of code using the memo attribute ([1], [2], > [3]) [...] As author of [2] (current version here [4]) I can tell you my reason. cvs2svn has to store a vast number of small objects in a database, then read them in random order. I spent a lot of

[Python-Dev] The interpreter accepts f(**{'5':'foo'}); is this intentional?

2009-02-05 Thread Michael Haggerty
I can't find documentation about whether there are constraints imposed on the keys in the map passed to a function via **, as in f(**d). According to http://docs.python.org/reference/expressions.html#id9 , d must be a mapping. test_extcall.py implies that the keys of this map must be string