On Thu, Jul 24, 2008 at 7:31 AM, David Kaplan <[EMAIL PROTECTED]> wrote:
> I committed the changes to clabel (r5830). Hey David -- thanks for these fixes. I noticed a couple of things I want to comment on * avoid the ternary operator, as in # Figure out label rotation. rotation,nlc = cs.calc_label_rot_and_inline( slc, imin, lw, lc if self.inline else [], self.inline_spacing ) since this requires python2.5. I replaced this, and a similar construct in contour.py, so please make sure I did the right thing * avoid needless *args, **kwargs usage. We do this all the time in pylab and to a lesser extent in axes.py because we are passing the function call on to another layer. In that case, at least document the proper signature as the first line in the docstring. But unless we need it, avoid it, eg in def start_event_loop(self,*args,**kwargs): """ Start an event loop. This is used to start a blocking event loop so that interactive f If you want to give the user who is using a known UI that supports extra args, do it like def func(self, timeout, **kwargs): and pass the kwargs through, but at lease require the known args and kwargs in the main signature. * Using an empty list in a python kwarg as the default is a gotcha, as in def calc_label_rot_and_inline( self, slc, ind, lw, lc=[], spacing=5 ): The reason is that if the function mutates the list, this often leads to unintended consequences as the list is module level and thus shared between instances and method calls. The standard idiom for mutable (lists and dicts) keyword args s def func(x=None): if x is None: x = [] I have fixed this in contour.py JDH ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel