characteristic
characteristic copied to clipboard
editor support? (i.e. pycharm)
One of the primary benefits I get from having types is that my editor can help suggest appropriate completions and let me know when I'm doing something stupid.
But my editor currently doesn't understand that a class decorated with @attributes
has a constructor that takes those named parameters.
What would it take for a python editor to be able to recognize Characteristic attributes?
Could it be done with static analysis, or would it be easier to find out by some run-time introspection?
Would it require code specific to Characteristic, or could it be done with more general python introspection and/or type annotations?
Ah, I just found https://youtrack.jetbrains.com/issue/PY-14367
You may also want to look at my own fork https://github.com/hynek/attrs which solves that problem too. :)
I think I’ll keep this open until they merge it. There’s also a ticket open for jedi.
attrs does look more readable to humans and IDEs. I'll look forward to when it no longer starts with "NOT READY YET." :)
I'll get it out at the PyCon sprints in the next days. :)