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

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.