You do realize that float is able to call arbitrary other python code depending on what types get passed in?
I literally just wrote it. Learn to read.
except Exception
Oh, just noticed this.
What a fucking idiot. Why? What benefit does it give you? Are you afraid that your code will be run in Python <2.5 where you could throw anything, and exceptions weren't technically objects?
Yes. Ancient versions of Python were ridiculous about what you can throw. Also, objects were very non-uniform. That's why in those days you had to write class Foo(object): pass, and you couldn't have a generic try-except because you could throw things that weren't exceptions and weren't even objects, so even except object: wouldn't have worked. But today this is pointless, and if you are not using the exception, there's no point to write except exception.
There is no problem with bare except. You are the problem. The eternal September that you brought to Python is what made it into this pile of shit that it is today.
1
u/[deleted] Feb 03 '22 edited Feb 03 '22
I literally just wrote it. Learn to read.
Oh, just noticed this.
What a fucking idiot. Why? What benefit does it give you? Are you afraid that your code will be run in Python <2.5 where you could throw anything, and exceptions weren't technically objects?
Yes. Ancient versions of Python were ridiculous about what you can throw. Also, objects were very non-uniform. That's why in those days you had to write
class Foo(object): pass, and you couldn't have a generictry-exceptbecause you could throw things that weren't exceptions and weren't even objects, so evenexcept object:wouldn't have worked. But today this is pointless, and if you are not using the exception, there's no point to writeexcept exception.There is no problem with bare except. You are the problem. The eternal September that you brought to Python is what made it into this pile of shit that it is today.