Import in Python

#Python

Import in Python

As noted in Structuring Your Project of Python Guide, import in python is rather tricky.

The style

from neuosc import *

grabs everything in neuosc and put them in the global namespace which is more likely to override existing functions in the global namespace.

A better way is to import the exact function we need.

from neuosc import par

Other good import methods are

import neuosc

or

import neuosc as ns

Published: by ;

Lei Ma (2015). 'Import in Python', Datumorphism, 12 April. Available at: https://datumorphism.leima.is/til/programming/import-in-python/.

Table of Contents

Current Ref:

  • til/programming/import-in-python.md