I\'m studying Python, after a lot of PHP experience, and it would be handy to have type-hinting in Python. Looks like Eclipse with PyDev doesn\'t support this. Any sug
For local scope variables and function parameters PyDev has this:
assert isinstance(obj, MyClass)
obj. # here hint will work
Though I guess it's a not documented feature. Here's PyDev's official page for type hints and couple of excerpts which illustrate Sphinx syntax.
class Example:
def param(self, a):
''':type a: MyClass'''
def var(self, iterable):
for a in iterable: #: :type a: AnotherClass
pass
Unfortunately, neither works for class members.
Since, PyDev 4 there's also something that can resemble PEP-484 (see below).
class LatestExample:
def listcase(self, param):
''':type param: list[str]'''
def dictcase(self, param):
':type param: dict[str, MyClass]'
Take a look at answer by @slushy. No doubt this is the future. But for the time being PyDev supports neither function annotations, PEP-3107, nor new PEP-484 stuff @slushy demonstrates. PEP-484 is coming in Python 3.5 in some limited form, and in 3.6 in final. Here's BDFL's PyCon 2015 presentation for type hints and PEP-484.