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


Groups > comp.lang.python > #66739

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <gary.herron@islandtraining.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'subject:not': 0.03; 'parameters': 0.04; 'classes,': 0.05; 'forgive': 0.05; 'assignment': 0.07; 'class,': 0.07; 'subject:code': 0.07; 'suppose': 0.07; 'assigning': 0.09; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; 'subject:skip:u 10': 0.16; 'wrote:': 0.18; 'creating': 0.23; 'header:User-Agent:1': 0.23; 'received:emailsrvr.com': 0.24; 'question': 0.24; 'class.': 0.26; 'received:(smtp server)': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'code': 0.31; 'gary': 0.31; 'class': 0.32; 'implemented': 0.33; 'sense': 0.34; 'created': 0.35; 'but': 0.35; 'there': 0.35; 'instances': 0.36; 'object,': 0.36; 'thanks': 0.36; 'similar': 0.36; 'error.': 0.37; 'whatever': 0.38; 'to:addr :python-list': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'first': 0.61; 'skip:a 40': 0.72; 'them)': 0.84; 'choice.': 0.93
X-Virus-Scanned OK
Date Thu, 20 Feb 2014 01:04:50 -0800
From Gary Herron <gary.herron@islandtraining.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Cannot figure out line of code, also not understanding error
References <da9b6b96-7e9a-4094-a3f4-74cdedaf869e@googlegroups.com> <e0d070e3-703b-4583-a845-a530b8302e1b@googlegroups.com>
In-Reply-To <e0d070e3-703b-4583-a845-a530b8302e1b@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
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.7177.1392887498.18130.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1392887498 news.xs4all.nl 2921 [2001:888:2000:d::a6]:36817
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:66739

Show key headers only | View raw


On 02/20/2014 12:26 AM, ApathyBear 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)
>
> can a similar line look like this?:
> temp1.pop(0) = Athlete(temp1.pop(0),temp1)

First some notation:  You are not creating a class, but rather in 
instance of a class.  The  code
   class Athlete:
     ...
  created the class, and now you are ready to create (many?) instances 
of that class.

A call like
     Athlete(...)
will create an instance of that class with whatever parameters you 
supply.  What you do with that instance after it is created is your 
choice.  Assignment is one possibility, but many other operation are 
also possible:

     x = Athlete(...)
     print( Athlete(...) )
     Athlete(...)+Athlete(...) # If addition made any sense and was 
implemented in the class
     return Athlete(...)
     ...


Gary Herron

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