Personally I prefer: try-except-else-finally over: try-except-finally-else Having the finally at the end makes imho more sense. Since it runs after else.
I am so grateful to all the Anthony explains videos that I get to see all of them early in my career. Would have taken me some time to learn a lot of the concepts on my own.
When talking about exceptions, I would also mention, what return statement in the various blocks does. For me it was confusing at the beginning, so maybe it would help others. For example: try: foo() return a except: ... else: return b finally: return c
can you also demonstrate 1) Nested Try /Except 2) A try except inside a while-loop ,for example, i have 10 id need to update or do whoever from the db , and any one of the action is fail, do you show a guide on this? thanks
variadic generics are still in the draft stage and did not make it into python 3.10 (if they land they'll be in 3.11 and I'll explain them when there's a stable implementation and type-checker support!)
I love how his haircut evolves through the episodes, as well as my knowledge after watching them! Keep it up, very enlightening :)
Personally I prefer: try-except-else-finally
over: try-except-finally-else
Having the finally at the end makes imho more sense. Since it runs after else.
actually looks like there's a mistake in the video then -- finally has to come after `else` otherwise it's a syntax error
I am so grateful to all the Anthony explains videos that I get to see all of them early in my career. Would have taken me some time to learn a lot of the concepts on my own.
When talking about exceptions, I would also mention, what return statement in the various blocks does.
For me it was confusing at the beginning, so maybe it would help others.
For example:
try:
foo()
return a
except:
...
else:
return b
finally:
return c
It is "stupid" example to have that many returns, but somebody may find the behavior of this snippet suprising.
Nice compeehensive guide to exceptions. Thanks. It is good reminder for all of that thing.
good one! prob worth noting not all try-except languages (e.g. JS) have the else case.
That was great. I felt pretty confident in my exception handling, but that was very informative.
can you also demonstrate
1) Nested Try /Except
2) A try except inside a while-loop ,for example, i have 10 id need to update or do whoever from the db , and any one of the action is fail, do you show a guide on this?
thanks
(1) you probably shouldn't
(2) there's nothing special beyond what I showed here
Do you have any thoughts to share on `raise...from...`?
yep! I go over that in the linked video in the description -- though most of the time I don't bother personally
You're a great teacher, thank you! 😃
I've never seen a keyboard in half.. but somehow it looks more practical haha
not me writing large try blocks 👀
Hi, explain pls variadic generics (pep646) in py310
variadic generics are still in the draft stage and did not make it into python 3.10 (if they land they'll be in 3.11 and I'll explain them when there's a stable implementation and type-checker support!)
@@anthonywritescode what do you think about +1 another syntax in python?
I think match and walrus are bad, splat-getitem seems not really that problematic relatively speaking
@@anthonywritescode splat-getitem? Sry, dont understand
the new syntax proposed in 646
Thank you
I can't read what you're typing
how small is your screen? the font size is very large
@@anthonywritescode 22" (1280x800 resolution). Watching in 720p.
Half your screen is wasted by a second, unused, window.
for me its is perfect
the second screen is used by running commands
Im watching on an 11“ iPad and I can see everything, I guess it’s your resolution that is very low