Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Python's contextlib is a HIDDEN GEM

Автор: Carberra

Загружено: 2024-06-10

Просмотров: 14087

Описание:

The purpose of contextlib is fairly evident by the name (unless you've never heard of context managers), but it has some really cool tools that I wanted to share! Plus, there's a really neat decorator trick you can achieve with it too!

00:00 - Intro
00:32 - Using @contextmanager to create context managers [1]
06:46 - Using closing to close contexts [2]
08:26 - Using suppress to suppress exceptions [3]
10:47 - Using redirect_stdout and redirect_stderr [4-5]
14:24 - Outro

[1] https://docs.python.org/3/library/con...
[2] https://docs.python.org/3/library/con...
[3] https://docs.python.org/3/library/con...
[4] https://docs.python.org/3/library/con...
[5] https://docs.python.org/3/library/con...

—

If you want to see more of me, join my Discord server!
  / discord  

I get a lot of people asking, so here's my setup!
• Visual Studio Code:    • My Visual Studio Code setup! (2024)  
• Terminal:    • Make your terminal look AMAZING  
• Desk/recording gear: https://kit.co/Carberra
• PC build: https://uk.pcpartpicker.com/list/TmzGYN

—

If you have any questions, don't hesitate to ask in the comments! I'll try and answer as soon as I can, providing someone else hasn't already done so.

#python #coding #howto

Python's contextlib is a HIDDEN GEM

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Partial functions in Python are SUPER NEAT

Partial functions in Python are SUPER NEAT

10 Nooby Mistakes Devs Often Make In Python

10 Nooby Mistakes Devs Often Make In Python

Generics are VITAL in typed Python

Generics are VITAL in typed Python

Асинхронность в python

Асинхронность в python

Python 3.14: The NEW T-strings are Awesome

Python 3.14: The NEW T-strings are Awesome

Why You Should Think Twice Before Using Returns in Python

Why You Should Think Twice Before Using Returns in Python

Writing & Keeping Code Clean

Writing & Keeping Code Clean

Are exception groups Python's MOST UNDERUSED feature?

Are exception groups Python's MOST UNDERUSED feature?

Скомпилированный Python БЫСТРЫЙ

Скомпилированный Python БЫСТРЫЙ

Are metaclasses the HARDEST thing in Python?

Are metaclasses the HARDEST thing in Python?

Декораторы Python — наглядное объяснение

Декораторы Python — наглядное объяснение

5 Useful Python Decorators (ft. Carberra)

5 Useful Python Decorators (ft. Carberra)

Are descriptors the most MISUNDERSTOOD part of Python?

Are descriptors the most MISUNDERSTOOD part of Python?

Учебное пособие по шаблону «Наблюдатель»: Я НИКОГДА не знал, что события настолько мощны 🚀

Учебное пособие по шаблону «Наблюдатель»: Я НИКОГДА не знал, что события настолько мощны 🚀

Бизнес-логика в dataclass, pydantic, attrs-классах или в обычных классах? ООП в Python

Бизнес-логика в dataclass, pydantic, attrs-классах или в обычных классах? ООП в Python

Typst: Современная замена Word и LaTeX, которую ждали 40 лет

Typst: Современная замена Word и LaTeX, которую ждали 40 лет

Python's pattern matching is EXCEPTIONAL

Python's pattern matching is EXCEPTIONAL

5 Uncommon Python Features I Love

5 Uncommon Python Features I Love

SIMPLIFY your code with decorators (+ typing)

SIMPLIFY your code with decorators (+ typing)

Sets are absolutely CRACKED in Python

Sets are absolutely CRACKED in Python

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com