logo

... setup: import



Notes

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.

Feedback? See an issue? Something unclear? Feel free to mention it here.



If you want to be kept up to date, consider signing up for the newsletter.