Python Context Managers and the "with" Statement (__enter__ & __exit__) - YouTube

► Discover Python's advanced features and how to use them to your advantageThe "with" statement in Python is regarded as an obscure feature by some. But when you peek behind the scenes of the underlying Context Manager protocol you'll see there's little "magic" involved.So what's the `with` statement good for? It helps simplify some common resource management patterns by abstracting their functionality and allowing them to be factored out and reused.In turn this helps you write more expressive code and makes it easier to avoid resource leaks in your programs.In this Python programming tutorial you'll see how you can add support for the "with" statement to your own objects either by implementing the "__enter__" and "__exit__" protocol or by using the contextlib @contextmanager decorator.You can use the approach demonstrated in the video to add support for the "open as" design pattern in your own Python classes to follow a more Pythonic style of OOP.To get more Python Tricks and to discover the full potential of Python check out "Python Tricks: The Book" at the link below.FREE COURSE – "5 Thoughts on Mastering Python" TRICKS: THE BOOK TO THIS CHANNEL: * *► Python Developer MUGS, T-SHIRTS & MORE: Python Tutorials & News:» Python Tutorials: Python News on Twitter: Weekly Tips for Pythonistas: Subscribe to this channel:

Richa Mittal

Nice looking eyebrows

Super Delusional

ok is it me or is Joana much cuter?

Youssef Zeineddine

Noo

Threw Conventional Housing Program.

Marc de haan

Yay dude perfect

Spooks Awc

I saw a huge bat in a building on CartoOnz' playthrough I think someone called it a ManBat. Is it not counted as a secret or an easter egg?

Frank Barbeite

5:03 how does that help XD

Mandy Penrose

Hi

Flying Play button

this girl should be happy that she didint get to go to school and suffer

Magdiel Santiago

Pinche camper de mierda 😡

gijsnl aartsen

0:00 i have that pink shirt too

Tyler Walker

I feel so bad for the person who died, may he or she rest in peace.

cooking with caylee

Look at Cory just wow. Go to 56 seconds to look at cory

Melialani

Idk why but this is kinda Relatable because I play softball

Crow Okatagi

Holagram, Hologram, Hollargram, holsnobd ki iui vc ejobdsadib. Boi

Sparklechip ,

Team coby

Cindy Eimer

Coby will win someday I know

M D

Is it just me or is 5:21 scary???

Brandon Mac

10:48 that face looks so salty

WebMastaWannaB

If anyone wants to know the song, it's Darude - Sandstorm

Chris Ray

You should film Antonio brown

me at the end: yeah this is 100% real

Snowflake Falls

IM TRIGGERED!!! its 5:59 LONG!!! NOT 6:00

Stephen

Damn how about Pete Carrol’s throws lol

Jacobson Studios

It's awesome you guys put Matthew Parkers music in your videos.

SmeTzeR2

im in love

Starlord 1234

Go Odell Beckham jr

jeebs, that must be harder for u tho lol

Land Zhark

Have you found these yourself or did you google them or something?

Iqra Ansari

Make one more video like this

zinc

2019?

Bruce Fisher

Anybody over the age of 10 actually find this worth watching..??

Jordan Hancock

I believe in you don't you are my favorite coby

RCH 5269

Nope i'm laughing at you

G R I N G O

I’m from Staten Island lol

Bloody Rouge

They were probably jealous that she was smarter than them, honestly

Tony Martinez

Cowboys need a WR

thederpycreeper

1:23 felt like he was whispering into my soul

Mountain Hangers

you should do a ZIPCHIP trick shots video they are rubber discs that fly very far and curve too

Shoopyman Sam

You need basketball hoops! Wait...You must need a hockey net! Oh... we just saw that...Then you have to have Quidditch goals!!!

TrippyZeno

Man really said gaming is getting expensive I need a new head set and a UPGRADED CHARGER like who tf needs a upgraded charger

Azhar Memon

Are these world records certificates real?

Horus Lux

I also voted pizza party...

James May

You wouldn't happen to have a playlist of all the music you use would ya?

LooneyMooney

North Korea, get over communism already. Even Germany and Russia got over it

Durrper

The strange pendant is a reference from dark souls

   

Nested Menu

Main