On Tue, Feb 25, 2014 at 1:59 AM, Gregg Martinson
<gregg.martin...@gmail.com> wrote:
> # problem is that myTeams has no value outside of the loop
> for x in myTeams:
>     x.print_team

No, that is not the problem.  The problem is, you’re missing
parentheses there and are not executing the print_team method, just
referring to it.  Do this:

for x in myTeams:
    x.print_team()

This causes this output:

[kwpolska@kw-cassandra /tmp]% python foo.py
code is:  a
code is:  aa
code is:  b
code is:  bb
code is:  c
code is:  cc
code is:  d
team code is:  a
debated: team code is:  aa
debated: team code is:  b
debated: team code is:  bb
debated: team code is:  c
debated: team code is:  cc
debated: team code is:  d
debated: [kwpolska@kw-cassandra /tmp]%

Which is kinda wrong.   But that’s the fault of your print_team() and
lack of competitors.
-- 
Chris “Kwpolska” Warrick <http://kwpolska.tk>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to