 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Is there something available in Python like PHP autoloader?
No, there isn't a direct equivalent to PHP's autoloader in Python and you don't need one also. To be specific, PHP needs autoloaders for the following reasons -
- For each web request to start a fresh PHP process.
- To load all the code from scratch for every request.
- For optimization by loading classes only when required .
- To avoid loading unnecessary files which improves performance.
In contrast, Python doesn't require autoloaders as files are not reread every time, and if you import something its imported for lifetime of the app. If you were to implement an autoloader in Python, it would run only one time and not on each request like PHP.
So autoloaders in PHP potentially give you a benefit of skipping the cost of file loading where you don't need it. In Python, you just load stuff when the app starts and new requests do not need to load anything extra.
Advertisements
 