Menu

#1351 Type Hinting should try to use @type

open
5
2011-07-19
2011-07-19
No

But here to illustrate how I'd expect it to work

class MyClass(object):
fields = None
"""Some fields

@type: dict
"""

a = MyClass()
a.fields. # Now it should show me dict type's auto completions

This would be particularly helpful for Django which uses extensively metaclasses and properties that are of "unknown" type like CharField, OneToOneField, ForeignKey, ...

(This is old request, and once discussed here http://sourceforge.net/projects/pydev/forums/forum/293649/topic/4388159 )

Discussion

  • Jari Pennanen

    Jari Pennanen - 2011-07-19

    I must note that in Django the @type for instance should take precedence of *other* methods of discovering type.

    So perhaps @type should have higher precedence than other ways of discovering type?

     
  • Jari Pennanen

    Jari Pennanen - 2011-07-19
    • summary: Type Hinting should try to fallback on @type --> Type Hinting should try to use @type
     
  • Jari Pennanen

    Jari Pennanen - 2011-07-19

    Another note about Django is that there could be some more pluggable way of adding type hintings.

    For instance I would add a very simple type hinting for Django, if class name is "CharField" -> string, OneToOneField + first parameter -> Model etc...