Discussion:
[Pydev-users] Generics in Pydev code analysis
Chi Ho Kwok
2014-11-06 10:41:47 UTC
Permalink
Hi there,


Is it possible to add generics support to the docstring parser in Pydev? I
used to use Pydev almost exclusively for Python/Django projects, but the
lack of support for "list of Stuff" or "dict from unicode to MoreStuff"
makes PyCharm a far better editor for more complex projects (if it works,
that is, its analysis is kinda buggy using fully qualified paths).

A real life examples from an __init__

self*.*characters *=* *[];* "@type: list of
(wol.world.models.Realm, unicode)"

self*.*fails *=* *[];* "@type: list of (unicode, unicode)"

self*.*lookupMap *=* *{};* "@type: dict from
(wol.world.models.Realm, unicode) to wol.world.models.Character"

With PyCharm's code analysis, I can subsequently write "for realm, name in
self.characters" with full typing support; in PyDev, it requires some
assert isinstance each time I reference these data structures.

In a small project, this doesn't matter much, but when there are a ton of
classes written in the past few years, you don't know exactly what to call
anymore, having a docstring parser that fully understands generics (and
tuples) in @type and @rtype increases productivity a lot.


Kind regards,
--
Chi Ho Kwok
Digibites Technology
***@digibites.nl
Fabio Zadrozny
2014-11-10 15:16:42 UTC
Permalink
Hi Chi Ho Kwok,

This is something planned, but it's still not done...

The issue is: https://sw-brainwy.rhcloud.com/tracker/PyDev/147, but I can't
really give you an estimate right now on when it'll be done, although I can
say it probably won't be done in a short-time period -- unless there's a
pull request for it -- as I'm currently working on other things -- although
it's also something I'd personally like to have, so, it's bound to be done
some time :)

Kind Regards,

Fabio
Post by Chi Ho Kwok
Hi there,
Is it possible to add generics support to the docstring parser in Pydev? I
used to use Pydev almost exclusively for Python/Django projects, but the
lack of support for "list of Stuff" or "dict from unicode to MoreStuff"
makes PyCharm a far better editor for more complex projects (if it works,
that is, its analysis is kinda buggy using fully qualified paths).
A real life examples from an __init__
(wol.world.models.Realm, unicode)"
(wol.world.models.Realm, unicode) to wol.world.models.Character"
With PyCharm's code analysis, I can subsequently write "for realm, name in
self.characters" with full typing support; in PyDev, it requires some
assert isinstance each time I reference these data structures.
In a small project, this doesn't matter much, but when there are a ton of
classes written in the past few years, you don't know exactly what to call
anymore, having a docstring parser that fully understands generics (and
Kind regards,
--
Chi Ho Kwok
Digibites Technology
------------------------------------------------------------------------------
_______________________________________________
Pydev-users mailing list
https://lists.sourceforge.net/lists/listinfo/pydev-users
Loading...