Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:code': 0.07; 'skip:o 60': 0.09; 'subject:number': 0.09; 'subject:python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'skip:d 60': 0.16; 'skip:o 70': 0.16; 'subject:program': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'skip:= 10': 0.20; 'please?': 0.22; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'to:addr :python-list': 0.33; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'wrong': 0.34; 'received:209.85': 0.35; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'gone': 0.64; '2013': 0.84; 'think...': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=bPL0TqDS70seQqLV8G0cv6mktnl5vRn1AnM+k9/31sk=; b=yRcE9Z0wNCQygjvNvaVNSwdIabZOheo30ljHrRyIzBu1uu4nlVv59k2L9k4FcussHr eNESkmo9EkduxZnu5MOsGFzssVHhteZ+W5lWCUNPdXkAsefl2OMJ1kK4ic1zP0dnYkeC 3yIZtZKvs9bnoXs6dDlQISCFu3eJ6CyZY6EZYhSS+PIHiRGa2w2xGy+yux4R6Xc/QFBq kscrtmXmxsMyYpXuPRIPlJ8P5eCgHxr97Oa9cbCswkjQSsmlMRu29jYP65aHyP3X3T5H Hmz7iZ0hjy28nVXgnDHaoXGylMNIItdO7wdiKXhzEmxYofpnEME/phY8gA64Dp8ZUgAO 2AfQ== MIME-Version: 1.0 In-Reply-To: <1357399067.54894.YahooMailNeo@web125504.mail.ne1.yahoo.com> References: <1357394154.35596.YahooMailNeo@web125506.mail.ne1.yahoo.com> <1357399067.54894.YahooMailNeo@web125504.mail.ne1.yahoo.com> Date: Sun, 6 Jan 2013 02:25:58 +1100 Subject: Re: Couting the number of lines of code of a python program From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357399567 news.xs4all.nl 6840 [2001:888:2000:d::a6]:58088 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36181 On Sun, Jan 6, 2013 at 2:17 AM, chaouche yacine wrote: > defcount_loc(lines):nb_lines =3D0docstring =3DFalseforline inlines:line = =3Dline.strip()ifline =3D=3D""\ orline.startswith("#")\ ordocstring andnot(= line.startswith('"""')orline.startswith("'''"))\ or(line.startswith("'''")a= ndline.endswith("'''")andlen(line)>3)\ or(line.startswith('"""')andline.end= swith('"""')andlen(line)>3):continue# this is either a starting or ending d= ocstringelifline.startswith('"""')orline.startswith("'''"):docstring =3Dnot= docstring continueelse:nb_lines +=3D1returnnb_lines Ow-what? Something's gone wrong with all your whitespace, I think... can you paste again please? ChrisA