title: Is there a way to check if a symbol is a valid operator in Python?
body: <p>isinstance can be used to check if the object which is the first argument is an instance or subclass of classinfo class which is the second argument.</p>
  
  <pre><code>a = 1
  b = [1]
  isinstance(a,list)
  isinstance(b,list)
  </code></pre>
  
  <p>Is there a similar way to check if an operator validate in Python? Something like</p>
  
  <pre><code>isoperator('=')
  isoperator(':=')
  isoperator('&lt;-')
  </code></pre>
  
  <p>I am trying to build an online executor for Python very beginner.</p>
  
  <p>When they input like this</p>
  
  <p><a href="https://i.stack.imgur.com/vrotD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vrotD.png" alt="enter image description here"></a></p>
  
  <p>they would get a hint, the operator is not supported rather than current error message.</p>