Calmcode - setup: import

Import

1 2 3 4 5 6 7 8 9

Remember that change we made to __init__.py in the previous video?

# inside of __init__.py
from clumper.clump import Clumper

This line imports the Clumper class. Because this is done in the __init__.py file it will also be initialised in the root of the module. This makes our import statements slightly nicer. Before we'd have to write:

from clumper.clump import Clumper

Now we can write:

from clumper import Clumper

Since this library will mainly feature that one class, it's nice that you do not need a submodule to import it. This is a nice feature but we've also added another method to our class.

    def collect(self):
        return blob

This method might be a more memorable way for users to get their lists of data back.