I saw that sometimes there are raised classes and sometimes there are raised instances of classes.
Which way to raise exception is better if you don't want to add any additional info as arguments
raise ValueError
or
raise ValueError()
?
It doesn't matter, as Python will create the instance if you only raised the class.
However, it is better to be explicit and create the instance yourself, to make it unambiguous you meant to use it without arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With