Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #66735
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'subject:not': 0.03; 'languages,': 0.04; 'syntax': 0.04; 'rest,': 0.07; 'subject:code': 0.07; 'matched': 0.09; 'mess': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; "wouldn't": 0.14; '*before*': 0.16; 'cause.': 0.16; 'detected': 0.16; 'expression.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'ioerror:': 0.16; 'subject:skip:u 10': 0.16; 'syntaxerror:': 0.16; 'wrote:': 0.18; 'properly': 0.19; 'thu,': 0.19; 'examples': 0.20; 'feb': 0.22; 'programming': 0.22; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'file.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'errors': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'getting': 0.31; 'helpful.': 0.31; 'file': 0.32; 'supposed': 0.32; 'run': 0.32; 'text': 0.33; 'open': 0.33; 'sense': 0.34; 'could': 0.34; 'problem': 0.35; 'except': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'keyword': 0.36; 'done': 0.36; 'doing': 0.36; 'should': 0.36; 'error.': 0.37; 'two': 0.37; 'pm,': 0.38; 'explain': 0.39; 'does': 0.39; 'delete': 0.39; 'read': 0.60; 'is.': 0.60; 'most': 0.60; 'skip:a 30': 0.61; 'first': 0.61; "you'll": 0.62; 'making': 0.63; 'real': 0.63; 'due': 0.66; 'between': 0.67; 'bottom': 0.67; '20,': 0.68; 'invalid': 0.68; 'skip:r 40': 0.68; 'computers': 0.72; 'horrible': 0.84; 'to:none': 0.92 |
| 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:cc :content-type; bh=r0gyeCtX7rjJ1ujMpG+KUmsAZoExsV+EX4I/eZiezFI=; b=JxZ9LNSDhZBDEZoc59YtEt6Zq5GZvzfKs0TD4Njghh4IMwRP/pcgBwnkyf5l4aoHHj 0bOhSZnGAVhc9DrZv5iYJlecZC4IB+bW0RTudBEHY3aOe1tCbn/VawRbYEqkfvHSxebQ rCjhmVJ21mPJGGTTUgAjOlTiASYVp7DC8Vt237dfHYclIzQaUjc//zl7/Urf+2wmHP9d hEX6nSGE5cuczWzYu9IIp+EqDdyORl1ub+SLnQvbjlxiIqw13KL0+F1W4nn+MOVySHxP GXSFPpqmpeoPcBMVuykLV+l02sjGyyi5qWtoSkTqlx070lrBGa4bm9mDIDp071ho3vep iBJA== |
| MIME-Version | 1.0 |
| X-Received | by 10.180.11.36 with SMTP id n4mr1114292wib.4.1392883417563; Thu, 20 Feb 2014 00:03:37 -0800 (PST) |
| In-Reply-To | <da9b6b96-7e9a-4094-a3f4-74cdedaf869e@googlegroups.com> |
| References | <da9b6b96-7e9a-4094-a3f4-74cdedaf869e@googlegroups.com> |
| Date | Thu, 20 Feb 2014 19:03:36 +1100 |
| Subject | Re: Cannot figure out line of code, also not understanding error |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7174.1392883425.18130.python-list@python.org> (permalink) |
| Lines | 38 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1392883425 news.xs4all.nl 2893 [2001:888:2000:d::a6]:48198 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:66735 |
Show key headers only | View raw
On Thu, Feb 20, 2014 at 6:32 PM, ApathyBear <nirchernia@gmail.com> wrote: > 1. What does this line of code mean: > return(Athlete(temp1.pop(0),temp1.pop(0), temp1) > > Is it making an Athlete class? if you can give examples to help explain what this is doing that would be helpful. It's supposed to be calling Athlete() with some arguments. However, due to the extra open parenthesis between the keyword "return" and the rest, it... > 2. Why am I getting this error when I try to run the file? > PS C:\Users\N\desktop> python gg.py > File "gg.py", line 34 > except IOError: > ^ > SyntaxError: invalid syntax > PS C:\Users\N\desktop> ... causes this error, which is detected at the point where a keyword comes in that makes no sense inside the return expression. The solution is to delete the first open parenthesis: return Athlete(temp1.pop(0),temp1.pop(0), temp1) Then you have properly matched parens, and it should carry on happily. Tip: Computers report errors where they find them, which isn't always where the error actually is. But with most modern programming languages, the file is read from top to bottom and left to right, so when a problem is reported, its cause is always *before* it in the file. Never after it. You could make a horrible mess of the file after that "except" and you wouldn't change the error. (Apart from things like text encoding, which are done in a separate pass.) You'll get used to scanning up a line or two from the error to find the real cause. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Cannot figure out line of code, also not understanding error ApathyBear <nirchernia@gmail.com> - 2014-02-19 23:32 -0800
Re: Cannot figure out line of code, also not understanding error Chris Angelico <rosuav@gmail.com> - 2014-02-20 19:03 +1100
Re: Cannot figure out line of code, also not understanding error Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2014-02-20 08:56 +0100
Re: Cannot figure out line of code, also not understanding error ApathyBear <nirchernia@gmail.com> - 2014-02-20 00:26 -0800
Re: Cannot figure out line of code, also not understanding error Chris Angelico <rosuav@gmail.com> - 2014-02-20 19:54 +1100
Re: Cannot figure out line of code, also not understanding error Gary Herron <gary.herron@islandtraining.com> - 2014-02-20 01:04 -0800
Re: Cannot figure out line of code, also not understanding error ApathyBear <nirchernia@gmail.com> - 2014-02-20 01:22 -0800
Re: Cannot figure out line of code, also not understanding error Chris Angelico <rosuav@gmail.com> - 2014-02-20 20:41 +1100
Re: Cannot figure out line of code, also not understanding error Dave Angel <davea@davea.name> - 2014-02-20 11:50 -0500
Re: Cannot figure out line of code, also not understanding error ApathyBear <nirchernia@gmail.com> - 2014-02-20 02:13 -0800
csiph-web