Software Engineering Principles in Python
Adam Spannbauer
Machine Learning Engineer at Eastman
working in work_dir/my_package/utils.py
def we_need_to_talk(break_up=False):
"""Helper for communicating with significant other"""
if break_up:
print("It's not you, it's me...")
else:
print('I <3 U!')
working in work_dir/my_script.py
# Import utils submodule
import my_package.utils
# Decide to start seeing other people
my_package.utils.we_need_to_talk(break_up=True)
It's not you, it's me...
working in work_dir/my_package/__init__.py
from .utils import we_need_to_talk
working in work_dir/my_script.py
# Import custom package
import my_package
# Realize you're with your soulmate
my_package.we_need_to_talk(break_up=False)
I <3 U!
Software Engineering Principles in Python