Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #66738

Re: Cannot figure out line of code, also not understanding error

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'subject:not': 0.03; 'classes,': 0.05; 'forgive': 0.05; 'assign': 0.07; 'subject:code': 0.07; 'suppose': 0.07; 'assigning': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '(when': 0.16; 'afterwards': 0.16; 'argument,': 0.16; 'bool': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:skip:u 10': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'feb': 0.22; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'integer': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'class.': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'function': 0.29; '[1]': 0.29; 'statement': 0.30; 'message- id:@mail.gmail.com': 0.30; 'that.': 0.31; 'class': 0.32; 'url:python': 0.33; 'sense': 0.34; "can't": 0.35; 'something': 0.35; 'no,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'object,': 0.36; 'thanks': 0.36; 'similar': 0.36; 'url:org': 0.36; 'error.': 0.37; 'pm,': 0.38; 'anything': 0.39; 'new': 0.61; 'url:3': 0.61; 'first': 0.61; 'back': 0.62; 'url:index': 0.63; 'choose': 0.64; 'different': 0.65; '20,': 0.68; 'skip:a 40': 0.72; 'them)': 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:content-transfer-encoding; bh=h6nC3pK7AB+HNYPulAmBTBMHjXrZMcG11x6oXbWLNK8=; b=jXD7qqXWJT6notFmV1FESjndtG3lAOcjhhGor2gb2JMXCiocX/iUk6UvrSCz7aI+4E uTduy+auZQTnCBIeLiaZAadbDS5piSsWdUGxPRHrVBK23hAOn88ra2irA6YICMyJO1V8 3sAbsfKmMBfdI+XIBlCB/4j05Kf0fvLPR3K/WaEsisvybR75vAtCic2waz4Er/HSTt27 gNQk+CikFMeAhvvkwy/xTgdaCXduaey+TjAEf+hvkL0yUF+ajQFPsC6WtUQvPhC8r/RQ HR2yM7ETsc2dJvAZ01NVxg9lXW1ZbQCa10pCVVaW1XA+lrABrwTYFy0rIdsUA03r6sFM 6dbA==
MIME-Version 1.0
X-Received by 10.68.112.164 with SMTP id ir4mr563868pbb.153.1392886494173; Thu, 20 Feb 2014 00:54:54 -0800 (PST)
In-Reply-To <e0d070e3-703b-4583-a845-a530b8302e1b@googlegroups.com>
References <da9b6b96-7e9a-4094-a3f4-74cdedaf869e@googlegroups.com> <e0d070e3-703b-4583-a845-a530b8302e1b@googlegroups.com>
Date Thu, 20 Feb 2014 19:54:54 +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
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 <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.7176.1392886498.18130.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1392886498 news.xs4all.nl 2845 [2001:888:2000:d::a6]:60625
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:66738

Show key headers only | View raw


On Thu, Feb 20, 2014 at 7:26 PM, ApathyBear <nirchernia@gmail.com> wrote:
> Thanks for pointing out the missing parenthesis, it makes sense now why there was an error.
>
> I suppose my question now is (and forgive my ignorance about classes, this is my first time learning them) why is it calling Athlete with some arguments? In order to make a class object, don't you need to create an instance by assigning a class to something?
>
> like:
>  x = Athlete(temp1.pop(0),temp1.pop(0),temp1)

Calling a class will create a new instance of it. [1] What you do with
it afterwards is separate.

The return statement takes any value and, well, returns it. You can
return anything - an Athlete instance, the integer 13423523452, the
floating point value NaN, anything at all.

> can a similar line look like this?:
> temp1.pop(0) = Athlete(temp1.pop(0),temp1)

You can't assign to a function call, so no, you can't do that.

I recommend you start with the Python tutorial:

http://docs.python.org/3/tutorial/index.html

ChrisA


[1] The class might choose to do something different (when you call
bool with some argument, it'll return a pre-existing True or False),
but conceptually, you still get back an instance of that class.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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