Re: Couting the number of lines of code of a python program

Discussion in 'Python' started by Dave Angel, Jan 5, 2013.

  1. Dave Angel

    Dave Angel Guest

    On 01/05/2013 10:17 AM, chaouche yacine wrote:
    > <snip>



    >
    > Here is my implementation :
    >
    > defcount_loc(lines):nb_lines =0docstring =Falseforline inlines:line =line.strip()ifline ==""\ orline.startswith("#")\ ordocstring andnot(line.startswith('"""')orline.startswith("'''"))\ or(line.startswith("'''")andline.endswith("'''")andlen(line)>3)\ or(line.startswith('"""')andline.endswith('"""')andlen(line)>3):continue# this is either a starting or ending docstringelifline.startswith('"""')orline.startswith("'''"):docstring =notdocstring continueelse:nb_lines +=1returnnb_lines


    Wow, this is thoroughly garbled. Please configure your email (yahoo?)
    to use text mode email, to not delete spaces, to honor newlines, etc.


    >
    >
    > ----- Original Message -----
    > From: Chris Angelico <>
    > To:

    Why is the quoted part *after* your message? Please don't top-post on
    this list (or most of them). It gets too garbled after one or two
    generations.



    --

    DaveA
     
    Dave Angel, Jan 5, 2013
    #1
    1. Advertising

  2. Dave Angel

    Roy Smith Guest

    In article <>,
    Dave Angel <> wrote:

    > On 01/05/2013 10:17 AM, chaouche yacine wrote:
    > > <snip>

    >
    >
    > >
    > > Here is my implementation :
    > >
    > > defcount_loc(lines):nb_lines =0docstring =Falseforline inlines:line
    > > =line.strip()ifline ==""\ orline.startswith("#")\ ordocstring
    > > andnot(line.startswith('"""')orline.startswith("'''"))\
    > > or(line.startswith("'''")andline.endswith("'''")andlen(line)>3)\
    > > or(line.startswith('"""')andline.endswith('"""')andlen(line)>3):continue#
    > > this is either a starting or ending
    > > docstringelifline.startswith('"""')orline.startswith("'''"):docstring
    > > =notdocstring continueelse:nb_lines +=1returnnb_lines

    >
    > Wow, this is thoroughly garbled. Please configure your email (yahoo?)
    > to use text mode email, to not delete spaces, to honor newlines, etc.


    Nice to know that wasn't just another case of my using an antiquated
    news reader :)
     
    Roy Smith, Jan 5, 2013
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jazzy
    Replies:
    3
    Views:
    10,631
    Gordon Beaton
    May 25, 2004
  2. chaouche yacine
    Replies:
    0
    Views:
    128
    chaouche yacine
    Jan 5, 2013
  3. Chris Angelico
    Replies:
    0
    Views:
    154
    Chris Angelico
    Jan 5, 2013
  4. Chris Angelico
    Replies:
    0
    Views:
    143
    Chris Angelico
    Jan 5, 2013
  5. chaouche yacine
    Replies:
    0
    Views:
    120
    chaouche yacine
    Jan 5, 2013
Loading...

Share This Page