RUVIDEO
Поделитесь видео 🙏

Java Code to Python | Exception Handling смотреть онлайн

This video provides an introduction to the exception handling concepts in python. It is highly recommended to handle exceptions. The main objective of exception handling
is Graceful Termination of the program . Exception handling does not mean repairing exception. We have to define alternative way to continue rest of the program normally.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Chapters
00:00 Intro
00:23 Generate Errors
01:42 Exceptions
03:39 try catch blocks
04:55 try catch blocks
05:59 finally block
06:24 else block
07:06 Custom Exceptions
08:18 Outro
-----------------------------------------------------------------------------------------------------------------------------------------------------------

Notes:-
1.) Every Exception in Python is a class.
And all the exceptions are treated in same way. All the exceptions are unchecked. There is nothing like the concept of checked exception in Python.

2.) All exception classes are child classes of BaseException. i.e every exception class extends BaseException either directly or indirectly. Hence BaseException acts as root for Python Exception Hierarchy.

3.) Within the try block if anywhere exception raised then rest of the try block won’t be executed even though we handled that exception. Hence we have to take only risky code inside try block and length of the try block should be as less as possible.

4.) We can write a single except block that can handle multiple different types of exceptions. Parentheses are mandatory and this group of exceptions internally considered as tuple.

5.) It is not recommended to maintain clean up code(Resource Deallocating Code or Resource Releasing code) inside try block because there is no guarantee for the execution of every statement inside try block always.
Also, It is not recommended to maintain clean up code inside except block, because if there is no exception then except block won't be executed.
Hence we required some place to maintain clean up code which should be executed always irrespective of whether exception raised or not raised and whether exception handled or not handled. Such type of best place is nothing but finally block.

6.) There is only one situation where finally block won't be executed ie whenever we are using os._exit(0) function.

7.) We can take try-except-finally blocks inside try or except or finally blocks.i.e nesting of tryexcept-finally is possible.
General Risky code we have to take inside outer try block and too much risky code we have to take inside inner try block. Inside Inner try block if an exception raised then inner except block is responsible to handle. If it is unable to handle then outer except block is responsible to handle.
try:
print("outer try block")
try:
print("Inner try block")
print(10/0)
except ZeroDivisionError:
print("Inner except block")
finally:
print("Inner finally block")
except:
print("outer except block")
finally:
print("outer finally block")
Output
outer try block
Inner try block
Inner except block
Inner finally block
outer finally block

8.) We can use else block with try-except-finally blocks.
else block will be executed if and only if there are no exceptions inside try block.

9.) The following are various possible combinations of except blocks.
▪ except ZeroDivisionError:
▪ except ZeroDivisionError as msg:
▪ except (ZeroDivisionError,ValueError) :
▪ except (ZeroDivisionError,ValueError) as msg:
?print(10/0)
?except ZeroDivisionError as msg:
?print("exception raised and its description is:",msg)
Output exception raised and its description is: division by zero
▪ except :

10.) Various possible Combinations of try-except-else-finally:
▪ without except or finally block we cannot write try block.
▪ except without try is always invalid.
▪ finally without try is always invalid.
▪ without except we cannot write else block
▪ In try-except-else-finally order is important
▪ nesting of try-except-else-finally is always possible.



-----------------------------------------------------------------------------------------------------------------------------------------------------------

If you liked the video Please Do Subscribe My Channel ???

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Thank you for Watching!
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java Code to Python | Exception Handling» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.