Salvador de la Puente González

Core / EN


07 Octubre 2018, 12:30 - 12:55

Everything is a (Python) module

Imagine importing a JSON file into Python as a module. Yes, I'm talking about having a config.json file and importing it with import config. Or even more, how about accessing JPG metadata with import gps_coordinates from album.IMG00001? The highly dynamic nature of Python, in addition to the right combination of magic methods and a pinch of monkey-patching, allow us to customise the import machinery up to the point of enabling these and other interesting use cases.