On 24 February 2013 22:08, Chris Angelico <ros...@gmail.com> wrote: > On Mon, Feb 25, 2013 at 8:35 AM, Joshua Landau > <joshua.landau...@gmail.com> wrote: > > def solve_quadratic(a, b, c): > > """Solve a quadratic equation of the form ax² + bx + c = 0 > > > > The result will be a tuple of the two results; the results can be equal > if > > the determinant is 0. > > This supports imaginary results for if the determinant is negative.""" > > ... > > results = [top/(2*a) for top in fraction_tops] > > Yeah, I think we know which one is the more readable... Just to > nit-pick a little though, that returns a list when its docstring says > it'll return a tuple :) >
Good catch. > Other than that (which is probably better solved by changing the docs > than the code), the only change I'd make would be to ditch the > fraction_tops temporary (and to throw out some of the comments that > serve only to reexpress the code that immediately follows them, though > for a demo they're entirely appropriate). > I knew someone would critique it. It's an exaggerated demo for foo's sake. Heck, who even uses a function like that (or uses unicode in comments :P)?
-- http://mail.python.org/mailman/listinfo/python-list