Admittedly I’m a python freshman, and I apologise in advance for what must be a very silly question, but I don’t understand the .valid member of the op class.
I’m looking for a python equivalent of opexists(’/nonexistentop’)
the doc says that the op class has a .valid attribute that should say if the operator exists or it has been deleted (it doesn’t say “it does not exist” not sure if there’s a difference there…)
and in fact op(’/’).valid is True
but, as I expected, op(’/nonexistent’).valid generates an error, instead of returning False.
so, what can I use in python to see if an operator exists before deciding whether or not to act on it? And what’s the use of .valid since it’s either True or else it generates an error?