3min chapter

Lex Fridman Podcast cover image

#381 – Chris Lattner: Future of Programming and AI

Lex Fridman Podcast

CHAPTER

How to Create a Defensive Copy in Python

In Python, you define a person class or maybe a person class is bad idea. And database class has an array of records and so the problem is that if you pass in a record or a class instance into database, it'll take a hold of that object and then it assumes it has it. They don't know this, right? And so now they suddenly get bugs. So what ends up happening is you say, okay, I will do what's called a defensive copy inside the database. And then that way, if somebody passes something in, I will have my own copy of it and they can go do whatever and they're not going to break my thing. This is usually the

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode