[Tutor] Issue with classes

Devin Jeanpierre jeanpierreda at gmail.com
Tue Jun 12 11:00:57 CEST 2012


On Tue, Jun 12, 2012 at 4:07 AM, Bod Soutar <bodsda at googlemail.com> wrote:
> I confess I don't know anything about classes really so I'm probably doing
> something stupid, but can anyone point me in the right direction?

A smaller example:

def foo():
    mydict = {}
    bar()
    print mydict

def bar():
    mydict[3] = 5


Why do you suppose mydict is not visible from bar?

This is the same reason that cf is not visible from methods on your class.

-- Devin


More information about the Tutor mailing list