I am from Java background. I am going through the official Python tutorials but can't seem to find the information in relation to Python source file names and classes.

In Java, file name is the same as main class name plus the .java extension. In Python what's the case? In the examples of official tutorials, they are writing multiple classes and there's no mention of the file name. I am kind of lost.

I have a file name called test_pie.py. The content is-

class ListTest:

    list1 = [2, 'a', 'ab', 'c', 'aa', 0]

    list2 = ['b', list1[-2:-5]] 

    def PrintList(self):
        print list1
        print list2

For list1 and list2: I get-

Undefined variable: list1 list Found at: test_pie

Undefined variable: list2 list Found at: test_pie

Edit
Report