Jeff Spaleta wrote: > On Fri, May 1, 2009 at 1:02 PM, Ignacio Vazquez-Abrams > <[email protected]> wrote: >> The value or callable passed to the constructor sets it. > > Should we just cobble together a pure python subclass that mimics this > behavior to use as a drop in replacement for the missing defaultdict? > Jef's found some code for defaultdict with a suitable license. We'll put it in python-fedora for now and look at spinning out a compat library if there's more problems. Between that and the python-sqlalchemy update from:
http://infrastructure.fedoraproject.org/el/5/i386/python-sqlalchemy-0.4.7-1.el5.noarch.rpm he seems to have all the EL-5 specific errors ironed out. kylev noticed some additional problems that are not related to python-2.4. * There's lots of methods defined with default arguments like this: component(self, start='1990-01-01', end=time.strftime("%Y-%m-%d"), component='kernel', status=[]): Default arguments are evaluated when the method is created. This means there's two problems with this code: 1) The time.strftime() is only going to be run once, when the program starts instead of every time the method is called (which is probably what's wanted). 2) The list created for status will be reused every time the method is called so it will only be a fresh, empty list the first time through. To solve these, use something like this: def component(self, start='1990-01-01', end=None, component='kernel', status=None): end = end or time.strftime("%Y-%m-%d") status = status or [] * This code would be clearer if rewritten: if str(status) == status: status = [status] instead do this: if isinstance(status, str): status = [status] * Code like this: triageByDate.c.keys()[k] are going to fail at some point. They assume that the list returned by .keys() will always put the keys in the same order. This is not guaranteed and adding and taking away other values in the dictionary can change the key at position k. -Toshio
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Fedora-python-devel-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/fedora-python-devel-list
