views:

64

answers:

1

Which is the best: create the modules and put them in a separate file and import them or put them all together in the same file?

Is there any significant difference?

+2  A: 

Same as disscussion on .py and .pyc. Having modules allows you to load them faster through precompiled modules. How ever negligible, this adds to performance. Though execution speed remains the same.

Please look at the following for a detailed answer. Repeating it is not useful.

[Edit:]

Decomposing the solution in modules is always better for future maintenance and enhances readability. The performance is almost always not the primary reason for decomposition of solution into various modules.

pyfunc