It just so happens python
abstracts away the inner workings of import statement beautifully. But are we aware of how python behaves when it encounters an import statement for a module?
- Better yet what is a module actually?
- Packages anybody?
- More than one import style? How to choose between them.
- How would different import styles compare with each other.
- Any Best practices when importing modules. What about that
__init.py__
you saw the last time you read someone else’s code.
This talk will walk you through the above and more.
- Modules
- What happens when you import a module?
- Packages
- Why packages
- Different styles for importing modules
- python 2 pitfalls
- Module names best practices
- Module lookup
- Modules get imported Only once!
- What really happens when you reload a module?
- Implicit Relative imports
- Absolute relative imports
- Explicit relative imports
- What should you put into
__init__.py
? Advantages in doing so?
- Questions?
A rough slide presentation has been created uploaded on speakerdeck.
python3
material present at: https://github.com/prodicus/talks/tree/master/pyconpune2017
- Engineering Intern('17) with the Cloud and Security Group @ Cisco, Bangalore.
- Former Software Engineering Intern(‘16) with the backend and infrastructure team @ Wingify, New Delhi, working towards building visual website optimizer, the world’s easiest A/B testing tool.
- Open source enthusiast and contributer to several organizations. Community member @ Coala-Analyzer.
- I do a bunch of side projects in my spare time that which sometimes get humble up votes on Product Hunt (the latest being Plino - An intelligent spam filtering system built as a service) (or) get featured by magazines like importpython, pythondigest and the like.
- I have significant programming experience in Python. In my past projects and gigs, I have built RESTful API’s, automation tools, chat bots, Machine learning tools, command line applications, cross platform desktop games and more.
- Most of my work can be found at my github repo(@prodicus). Some of my notable work @ tasdikrahman.me/projects
- I have previously spoken @ ChennaiPy, October '16 meetup. Slides can be found @ tasdikrahman.me/talks
https://speakerdeck.com/tasdikrahman/diving-deep-on-how-imports-work-in-python-pycon-pune-2017-proposed-talk
{{ gettext('Login to leave a comment') }}
{{ gettext('Post a comment…') }}{{ errorMsg }}
{{ gettext('No comments posted yet') }}