Is there any way to help complete PyDev code by specifying the type of the variable?
With PDT, you can use PHPDoc-like syntax for this purpose:
/* @var $my_var MyClass */ $my_var = myFunction(); // PDT is able to figure out that $my_var is a MyClass object.
But so far I can’t figure out how to do the same in python.
No (see docs ). It seems that PyDev is replenishing imported materials and language keywords.
, . , , , pydev, . , , , ( ).
, , assert isinstance()
:.
a = function() assert isinstance(a, MyClass) a. <- would get the proper completions
, Pydev , , , .
, , python -O ( )
, , PyDev 2.2.2; ?
, , :
class Foo(object): def __init__(self, bar): self.bar = bar # Tricking PyDev if (not self.bar): self.bar = Bar() raise Exception("Bar should not be null")
, , - (, , )
Source: https://habr.com/ru/post/1727541/More articles:Visual C # 2010 MSVCR100.dll is missing when opening a project - windows-7Iphone I use cocos2d and need rgba pixel value on sprite - iphoneCreate C ++ code from Visio UML diagram - c ++mutableCopyWithZone, copy NSMutableArray? - objective-cDefine a .net link to always use the latest GAC'd dll? - .netJQuery selector: How to change the src attribute of an image tag when you hover over a link - jquerywrite and memory leak - delphiGarbage collection in Java - javaиспользуя имена учетных записей в качестве соли - cryptographyIs StringComparer.CurrentCulture the right choice to use in this case? - .netAll Articles