The video owner has disabled playback on external websites.

This video is no longer available on YouTube.

This video cannot be played right now.

Watch on YouTube

Unlock AI-Powered Learning Tools

Sign up to access powerful tools that help you learn faster from every video.

Scene Explainer Phrase Hunter Flashcard Review Shadowing Practice Talk Back
Sign Up Free
B1 Intermediate English 15:39 2,570 words Science & Tech

Python Has the Best Standard Library Ever: 10 Modules You Need to Know

Late Night with Seth Meyers · 101,981 views · Added 1 month ago

AI Summary

This video explores Python's powerful built-in standard library, highlighting modules that streamline development and reduce the need for external dependencies. Learners will discover how to simplify data structures using **dataclasses** and manage file systems more intuitively with the object-oriented **pathlib**. The tutorial also covers **functools** for performance optimization through caching, **tomllib** for native configuration parsing, and **graphlib** for managing complex task dependencies. Finally, it introduces **heapq** for efficient priority queue management. By mastering these underutilized tools, viewers will gain the skills to write cleaner, more "Pythonic" code and improve their software design efficiency.

Learning Stats

B1

CEFR Level

2,570

Total Words

609

Unique Words

4/10

Difficulty

Vocabulary Diversity 24%

Subtitles (381 segments)

00:00

Python's standard library is crazy

00:02

powerful. Most people know about JSON or

00:05

OS, but there are modules that can save

00:08

you hours of work and you're probably

00:10

not using them. Today, I'll show you 10

00:13

powerful standard modules you should

00:16

absolutely know about. Before I start,

00:18

if you want to learn more about how to

00:20

design a piece of software from scratch,

00:22

I have a free guide for you. You can get

00:24

it at iron.code/design

00:26

guide. This contains the seven steps I

00:29

take when I design new software and

00:31

hopefully it helps you avoid some of the

00:32

mistakes I made in the past. The link is

00:35

also in the video description. First

00:37

module I want to talk about is data

00:39

classes. Now you are probably already

00:41

using data classes, but I still think it

00:44

deserves a mention on this list. You

00:47

might also say, "Hey, didn't you do a

00:49

video a couple of weeks ago where you

00:50

said you were no longer using data

00:52

class? So what is this all about?" Well,

00:54

it's not that I'm no longer using data

00:56

classes. I actually still use them, but

00:59

I don't use them in production systems

01:02

as much because then I notice that I

01:04

often end up using things like Pantic or

01:06

whatever ships with the specific

01:09

framework or library I'm working with.

01:11

Now, data class themselves are still

01:14

quite helpful to me. I really use them

01:16

quite often for quickly coming up with

01:18

some ideas in my Python scripts,

01:20

creating a few classes that store a bit

01:22

of data, making some relationships, and

01:24

seeing how everything fits together. And

01:27

for me, data class work really well for

01:28

that because they're just so easy to

01:30

use. Here you see an example of how they

01:32

work. So you simply import the data

01:34

class decorator from data classes. You

01:37

put that on top of your class and then

01:38

you specify the attributes of the class

01:41

by using type annotations. You can do

01:44

default values like this which is really

01:46

helpful. And there's a ton of other

01:48

things as well. For example, you can

01:49

also make a data class frozen. And that

01:53

way if you do that and actually type

01:56

booleans correctly, then you can also

01:58

make read only data class, read only

02:01

objects, which is quite nice as well.

02:04

Also, data classes add a bunch of

02:06

default behavior. For example, in this

02:08

case, as you can see, there's no need

02:09

for initializer, but we still have one

02:11

where we can pass the arguments uh as we

02:14

want. Uh there is a wrapper. So, if you

02:17

print a in this case an instance of that

02:20

data class, it's going to give us

02:22

something useful instead of just the

02:23

memory address. So, overall data classes

02:26

are really helpful for that. Here you

02:28

see what we get as a result when I run

02:30

this little piece of code. The second

02:32

library that I think more people should

02:34

use is path lip which basically supplies

02:37

a modern way of dealing with file path.

02:40

It replaces os.path with an

02:42

object-oriented approach to file path.

02:44

And the nice thing about path lil is

02:47

that you can use the slash operator to

02:49

construct more complex paths. So in this

02:52

case I have my base which is the my

02:54

project folder. That's a path object.

Full subtitles available in the video player

Key Vocabulary (50)

you A1 pronoun

Used to refer to the person or people that the speaker is addressing. It is the second-person pronoun used for both singular and plural subjects and objects.

run A1 verb

To move quickly on foot by taking steps faster than a walk, where both feet are momentarily off the ground. It can also mean to lead, manage, or be in charge of an organization or activity.

create A1 verb

To bring something new into existence or to make something happen using your imagination or skills. It involves producing something that did not exist before, such as a work of art, a solution, or a digital file.

Practice with Exercises

Generate vocabulary, grammar, and comprehension exercises from this video

Vocabulary & Grammar Comprehension Quiz IELTS Exam Writing Practice
Sign up to practice

Comments (0)

Login to Comment
No comments yet. Be the first to share your thoughts!

Sign up to unlock full features

Track progress, save vocabulary, and practice exercises

Start learning languages for free