Save this video free

CS 238 Week 3 Lecture

James Andro-Vasko · 22:29 · Watch on YouTube

Part of University of Nevada, Las Vegas CS 238. See all 9 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

James Andro-Vasko demonstrates how to place a Python `Clock` class in `clock_util.py` and reuse it from separate main programs, comparing module imports, aliases, and selective imports. He then shows how lists and dictionaries can store `Clock` objects, iterate over them, and invoke methods such as getters and setters through each retrieved object.

Key takeaways

Chapters

0:00 Importing the Clock Class from clock_util.py
5:30 Module Aliases, Selective Imports, and Naming Conflicts
9:50 Storing and Iterating Through Clock Objects in Lists
15:14 Mapping Clock Objects to Dictionary Keys

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:00 Hey everybody. Uh welcome to uh week three uh lecture video for the CS 238 class. For this um video, we're going to just essentially go over um similar content from last week. So we'll go over this uh clock type again, but in this video we're going to cover how to um import our custom classes and modules into other uh files. And also we will go over maintaining a list and dictionary of custom types. So we can have a dictionary or a list of um clock objects. Let's go ahead and uh begin talking about that. Okay. So before I go into this um

0:48 importing I want to first just mentioned I created a clock util. py uh file and the purpose is so it's not going to create any uh possible confusion when we import anything. So that's our first step. So um pretty much you've probably done importing in your CS138 class already. You would import pandas or um numpy. my own personal um content I did import in the past sci and not and mapplot lib um in the past and of course all kinds of you know python modules you can import so right now we're focusing on importing our custom module so right now our clock util py that's going to be our custom module and within this module

1:36 we have only one attribute this uh class clock defined within it so to um import this into my main I would just use import clock util. So since our file is called clock util. py then clock util without the py without the py that's going to be our module name. And also make sure that you have your module and your main in the same directory. So if I ls here on Linux

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, James Andro-Vasko.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.