characteristic icon indicating copy to clipboard operation
characteristic copied to clipboard

editor support? (i.e. pycharm)

Open keturn opened this issue 9 years ago • 4 comments

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?

keturn avatar Apr 13 '15 01:04 keturn

Ah, I just found https://youtrack.jetbrains.com/issue/PY-14367

keturn avatar Apr 13 '15 01:04 keturn

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.

hynek avatar Apr 13 '15 15:04 hynek

attrs does look more readable to humans and IDEs. I'll look forward to when it no longer starts with "NOT READY YET." :)

keturn avatar Apr 13 '15 18:04 keturn

I'll get it out at the PyCon sprints in the next days. :)

hynek avatar Apr 13 '15 18:04 hynek