0
Why assertions are so important in Python?
Cose if you know the error why you can't just fix it? Can anyone give me "real life example", maybe when i have 1000 lines of code it is important? I was reading lesson about assertions but still don't get when i should use it and don't just fix the error in code line.
1 Resposta
+ 1
They are meant for user error. If you didnt write the program, odds are you dont know everything about it. Exception raising and handling takes care of mistakes that the user makes while entering input. If my program asks for a birthdate but the user supplies a name, the program should raise an error or not let the user continue until the correct form of data is entered