What's So Special About Finally in Python?

  Рет қаралды 3,796

NeuralNine

NeuralNine

Ай бұрын

In this video, we discuss why one would ever use a finally statement in Python, as well as its hidden powers.
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚
🐍 The Python Bible Book: www.neuralnine.com/books/
💻 The Algorithm Bible Book: www.neuralnine.com/books/
👕 Programming Merch: www.neuralnine.com/shop
💼 Services 💼
💻 Freelancing & Tutoring: www.neuralnine.com/services
🌐 Social Media & Contact 🌐
📱 Website: www.neuralnine.com/
📷 Instagram: / neuralnine
🐦 Twitter: / neuralnine
🤵 LinkedIn: / neuralnine
📁 GitHub: github.com/NeuralNine
🎙 Discord: / discord

Пікірлер: 16
@dzadafa
@dzadafa 28 күн бұрын
2:30 it literally said, "You can run, but you can't escape" 💀
@IdPreferNot1
@IdPreferNot1 28 күн бұрын
Love the quick explanations
@dandyexplorer4252
@dandyexplorer4252 28 күн бұрын
You can actually escape it. When I ran: from os import _exit try: print('a') _exit(0) finally: print('b') I got: a
@it_is_random
@it_is_random 28 күн бұрын
I know cuz I am a python dev with big brain try: sys.exit()
@RocktCityTim
@RocktCityTim 28 күн бұрын
In that case, you've stepped out of your normal flow since the _exit() is used to force exit the process with specified status without calling cleanup handlers, flushing buffers, or any other end of process steps.
@applecastaway4256
@applecastaway4256 27 күн бұрын
It’s like pulling the power plug when your computer hangs and say you manually shut it down
@RocktCityTim
@RocktCityTim 27 күн бұрын
@@applecastaway4256 Exactly - if you're in the middle of a big edit on your system and pull the plug, anything not saved at the loss of power is lost - and, if the filesystem doesn't offer proper synchronization, the filesystem itself could become corrupted.
@youssefalkhodary
@youssefalkhodary 27 күн бұрын
very helpful
@rijuroy7415
@rijuroy7415 25 күн бұрын
Loved it
@vishnubalaji9500
@vishnubalaji9500 28 күн бұрын
so will this function always execute if or breaks? def f(): try: except: finally: continue
@daniloelias9887
@daniloelias9887 28 күн бұрын
I knew of all of these features already, but i really hoped you would show a use case in which this super power, which I agree it is one, is actually useful or necessary... 'finally' is weird and fun to play with, but I coudnt find in 9 years of coding one situation in which it saved me or was actually necessary... BTW I love this channel thanks for everything you post, this is me ranting because of finally not you, thanks from brazil
@thomasbrotherton4556
@thomasbrotherton4556 25 күн бұрын
Surprised you didn’t mention the else option of try
@Programing2024
@Programing2024 28 күн бұрын
What phone do you use?
@philtoa334
@philtoa334 23 күн бұрын
Thx_.
@zoookx
@zoookx 28 күн бұрын
Finally
@Azeem_Idrisi
@Azeem_Idrisi 28 күн бұрын
Finally (2)
Set Operations in Python Simply Explained
16:22
NeuralNine
Рет қаралды 2,2 М.
What Does "yield from" Do in Python?
5:37
NeuralNine
Рет қаралды 5 М.
Is it Cake or Fake ? 🍰
00:53
A4
Рет қаралды 19 МЛН
Пробую самое сладкое вещество во Вселенной
00:41
Кушать Хочу
Рет қаралды 4,1 МЛН
«АВТОРСКАЯ ПРОГРАММА РОМАНА БАБАЯНА (16+)» 17.06
1:54:40
Говорит Москва
Рет қаралды 64 М.
Python's 5 Worst Features
19:44
Indently
Рет қаралды 91 М.
Create Custom New Types in Python
7:55
NeuralNine
Рет қаралды 10 М.
Python Classes Tutorial #5 | Advanced Concepts
10:08
Aikonic
Рет қаралды 7 М.
5 Really Cool Python Functions
19:58
Indently
Рет қаралды 46 М.
Unlocking your CPU cores in Python (multiprocessing)
12:16
mCoding
Рет қаралды 293 М.
All 71 built-in Python functions
19:58
mCoding
Рет қаралды 42 М.
New Features You Need To Know In Python 3.12
12:04
ArjanCodes
Рет қаралды 177 М.
What is Scope in Python??
10:25
b001
Рет қаралды 44 М.
5 Cool Python One-Liners
12:23
Indently
Рет қаралды 26 М.
МОЩНЕЕ ТВОЕГО ПК - iPad Pro M4 (feat. Brickspacer)
28:01
ЗЕ МАККЕРС
Рет қаралды 84 М.
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 6 МЛН
Main filter..
0:15
CikoYt
Рет қаралды 7 МЛН
сюрприз
1:00
Capex0
Рет қаралды 1,4 МЛН