Why am I unable to perform a simple operation in the __init__ of my class?
===

Given below is a snippet from a class of which I am trying to create objects and getting error:


    class FoF(object):
            def __init__(self,path):
                    filepath=[]
                    filepath.append(self.FileOrFolder(path))

Upon executing which I get the following error:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "PathOps.py", line 6, in __init__
        def __init__(self,path):
      NameError: global name 'filepath' is not defined

After which I tried:

    filepath=[]
    class FoF(object):
            def __init__(self,path):
                    global filepath.append(self.FileOrFolder(path))

And again:

    File "<stdin>", line 1, in <module>
      File "PathOps.py", line 6, in __init__
        global filepath.append(self.FileOrFolder(path))
    NameError: global name 'filepath' is not defined


What is causing the error and how do I fix it?