1

I have noticed, in python, that the path to a script can take 2 forms

filename.py

or

filename/__init__.py

What is the reason for this?

user2764108
  • 146
  • 2
  • 10
  • 1
    https://docs.python.org/2/tutorial/modules.html#packages and http://stackoverflow.com/questions/448271/what-is-init-py-for will offer detailed explanation. – msvalkon Apr 25 '14 at 09:47

1 Answers1

2

simply, if you have a large filename.py containing many classes. you want to split them into separate files, and keep them under the same namespace. you can use the 2nd method.

Xing Fei
  • 287
  • 1
  • 6