Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

Introducing Packages

alphafox28js on Dec. 5, 2023

Method 4 was skipped over. I did try it, however it produced an AttributeError: ‘function’ object has no attribute ‘add’…

Not sure why VS Code did not like it :)

# 4
from adder import add as c, double as d

print('----import Method 4----')
print('----from <module> import <name> as <another_name>----')

value = c.add(2, 2)  # name.add() is an example of namespace usage.
print(value)

# Adding Namespaces to Objects:
double_value = d.double(value)
print(double_value)

alphafox28js on Dec. 5, 2023

This Course would be more beneficial in learning right before the OOP Course. I believe the 2% of unusable code I have from the OOP Exercises and Farm would have been correct if the Import Methods were defined before hand since different Methods will help if multiple names of the same are given… Other than that, Notes taken and good info.

Become a Member to join the conversation.