Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.x-privat.org!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'throw': 0.09; 'tuple': 0.09; 'yeah,': 0.09; 'cc:addr:python- list': 0.10; 'def': 0.10; 'c):': 0.16; 'code),': 0.16; 'docstring': 0.16; 'quadratic': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'unicode': 0.17; '(or': 0.18; 'feb': 0.19; 'email addr:gmail.com>': 0.20; "i'd": 0.22; 'cc:2**0': 0.23; '>': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; '(which': 0.26; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'chris': 0.28; 'probably': 0.29; 'function': 0.30; 'code': 0.31; '(and': 0.32; 'comments': 0.33; 'says': 0.33; 'docs': 0.33; 'equal': 0.33; 'skip:& 20': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85': 0.35; 'serve': 0.36; 'two': 0.37; 'uses': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'supports': 0.38; 'some': 0.38; 'little': 0.39; 'think': 0.40; 'more': 0.63; 'results': 0.65; '2013': 0.84; 'determinant': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=2ZyukCFsekHr43l/2/Y4TuraNOR+G99IZ7tGT1NJv1k=; b=na/jyZ/b5+INzoO1Km91sR3aOEwsDOoPRy++HE+9Qu9sH6H32W5tpyJ2QkRBzC0VDQ 4rUOSen6npES4Iovq+mbk5GXRCLVnTtEbOBf4+4xPj/47XDoOWJMqJlFKng53RGEMBS5 SE7CoLRC8mwF0maRi/FmfftKNZLvct11aPnVaNvR932A1BdZN03qlDoniPI6s3HgGwpa JLXuwb7gWlGie7QGe3kJkRetyhI+fRgUGMFyplr03QjUPE3rCQZcj2P1Xz0bCm4JTOQv cfEzVQSNeyDogyXM9clwujhyE0QJcW1GyGsSPJfyJGw5fP8TjTt0lO1gVqqYuPspFqp5 D/gw== X-Received: by 10.112.103.67 with SMTP id fu3mr3677354lbb.46.1361746316384; Sun, 24 Feb 2013 14:51:56 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <5127848B.1060004@gmail.com> <928d2cf7-728b-4f35-b8c9-4c9b958507e5@googlegroups.com> <8eadd52c-d533-4333-8c7f-7bf3a6d7b046@googlegroups.com> <9p1ii899tkalvfd1cl7sneoqa9t1cqh4oj@invalid.netcom.com> <5129482F.3080402@gmail.com> <512a5199$0$29998$c3e8da3$5496439d@news.astraweb.com> <5a3bf25b-a08b-4084-a940-e1fd05a1045d@googlegroups.com> From: Joshua Landau Date: Sun, 24 Feb 2013 22:51:16 +0000 Subject: Re: Python Newbie To: Chris Angelico Content-Type: multipart/alternative; boundary=f46d0401fabb765ae504d68045d0 Cc: python-list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 78 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361748026 news.xs4all.nl 6917 [2001:888:2000:d::a6]:59738 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39816 --f46d0401fabb765ae504d68045d0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 24 February 2013 22:08, Chris Angelico wrote: > On Mon, Feb 25, 2013 at 8:35 AM, Joshua Landau > wrote: > > def solve_quadratic(a, b, c): > > """Solve a quadratic equation of the form ax=B2 + bx + c =3D 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 =3D [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)? --f46d0401fabb765ae504d68045d0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 24 February 2013 22:08, Chris Angelico <rosuav@gmail.co= m> wrote:
On Mon, Feb 25, 2013 at 8:35 AM, Joshua Landau
<joshua.landau.ws@gmail.co= m> wrote:
> def solve_quadratic(a, b, c):
> """Solve a quadratic equation of the form ax=B2 + bx + = c =3D 0
>
> The result will be a tuple of the two results; the results can be equa= l if
> the determinant is 0.
> This supports imaginary results for if the determinant is negative.&qu= ot;""
> ...
> results =3D [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.
=A0
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 unic= ode in comments :P)?
--f46d0401fabb765ae504d68045d0--