Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'syntax': 0.04; 'elif': 0.05; 'interpreter': 0.05; 'error:': 0.07; 'string': 0.09; '"no"': 0.09; 'function,': 0.09; 'noted,': 0.09; 'restart': 0.09; 'statements': 0.09; 'subject:Why': 0.09; 'python': 0.11; 'def': 0.12; 'bug': 0.12; '""")': 0.16; '"n"': 0.16; '"new': 0.16; '(around': 0.16; 'block.': 0.16; 'fine.': 0.16; 'hits': 0.16; 'limit.': 0.16; 'looping': 0.16; 'subject: \n ': 0.16; 'subject:run': 0.16; 'subject:under': 0.16; 'subject:when': 0.16; 'wrote:': 0.18; 'stack': 0.19; 'thu,': 0.19; 'entered': 0.20; 'error': 0.23; 'string,': 0.24; 'looks': 0.24; 'header:In-Reply- To:1': 0.27; "doesn't": 0.30; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'lines': 0.31; 'accomplished': 0.31; 'sep': 0.31; 'though.': 0.31; 'url:python': 0.33; 'guess': 0.33; 'third': 0.33; 'there,': 0.34; 'could': 0.34; 'problem': 0.35; 'editor': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'skip:~ 10': 0.36; 'url:listinfo': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'error.': 0.37; 'example,': 0.37; 'list': 0.37; 'expected': 0.38; 'branch': 0.38; 'whatever': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'enough': 0.39; 'called': 0.40; 'url:mail': 0.40; 'break': 0.61; 'new': 0.61; 'john': 0.61; 'times': 0.62; 'name': 0.63; 'different': 0.65; 'close': 0.67; 'yes': 0.68; 'caused': 0.69; 'subject:have': 0.80; 'william': 0.81; 'local,': 0.84; 'shadows': 0.84; 'why?': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=NsrfE/Vri9Q4Dhg3J/2f9aNBQkQVyXlT33Q2mmHMR0Y=; b=mfY4AuIBu4xiWOTfHtR/bbBlTwW1YcYucSo4AFaDbSeLUdTJTKTLLygncRMRMPmZfK FGdX0R66+xZKf6hK+Kmfbqr8SSkDuPY+gxx0b+SpIJB6msm+WmoBe2SO6Ydg9A4Ua+J+ dCjdMgF9/NBLqlZLGYUoVpWmRo8amU+4kEBxCGh1VEEzhXjcmgHqrkvQJ1cUlh32JLX7 mBBMFLTZlCL65kXOnvqxRgIszgnd/C42lnyKCEuSMni68ymvnqyv9g+onPmdh0WhAIhC cT7vlCJ0twOtJSg9QmeJqv+IiQYxBWuOsM2eiyhucPQomoGOmwfsfEZBa2d1zd52JYKx qLKA== X-Received: by 10.68.252.165 with SMTP id zt5mr3646054pbc.118.1379617303706; Thu, 19 Sep 2013 12:01:43 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <22b99b0a-598f-4500-9de9-5041c2ce2c8f@googlegroups.com> References: <22b99b0a-598f-4500-9de9-5041c2ce2c8f@googlegroups.com> From: Ian Kelly Date: Thu, 19 Sep 2013 13:01:02 -0600 Subject: Re: Why does it have red squiggly lines under it if it works perfectly fine and no errors happen when I run it? To: Python Content-Type: text/plain; charset=ISO-8859-1 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: 55 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1379617747 news.xs4all.nl 15912 [2001:888:2000:d::a6]:41623 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54439 Syntactically, it looks fine. I would guess the problem is with whatever editor you are using. Or as John noted, it could be caused by the code above it. I do see an unrelated bug in there, though. You are using the name "restart" both for a string entered by the user and for the name of the function, which is called recursively. The name for the string, which is local, shadows the name for the function, which is global. So if the program ever hits the third branch of the if statement you will get an error. Python doesn't optimize tail-recursion, so you would get a different error if the user hit that branch enough times (around 1000) consecutively, as the interpreter hits the stack limit. For example, if they just held down the Enter key for a while. So this looping would be better accomplished with a while True loop and break statements than with recursion. On Thu, Sep 19, 2013 at 12:46 PM, William Bryant wrote: > the word 'def' has squiggily lines but the program works fine. It says: Syntax Error: expected an indented block. - why? > > def restart(): > print(""" > > ~~~~~~~~~~~~~~~~ > > Cacluation DONE! > > ~~~~~~~~~~~~~~~~ > > """) > restart = input("\nEnter yes if you want to make a new list and no if you want to close the program (yes/no): ") > restart > if restart == "yes" or restart == "y" or restart == "new list": > print("You want make a new list...\n") > time.sleep(1) > NOS() > elif restart == "no" or restart == "n" or restart == "close": > print("Goodbye!") > time.sleep(1) > print("Goodbye!") > time.sleep(1) > print("Goodbye!") > time.sleep(1) > print("Goodbye!") > time.sleep(1) > print("Goodbye!") > time.sleep(1) > quit() > else: > print("type y or n") > time.sleep(0.5) > restart() > -- > https://mail.python.org/mailman/listinfo/python-list