[wingide-users] RE: What doc tool do you use?
Linos
info at linos.es
Fri Oct 14 07:27:29 MDT 2011
El 05/10/11 21:46, Wing IDE Support escribió:
> On 10/5/11 2:02 PM, Linos wrote:
>> In the meantime can i use .pi files to declare method signatures and variables?
>> if so what syntax do i have to use to declare this:
>>
>> file test.py:
>> class test(object):
>> def __init__(self, par1, par2):
>> var1 = complicated_and_long_func()
>
> Put a test.pi file in the same directory with (assuming everything is a str for
> purposes of the example):
>
> class test(object):
> def __init__(self, par1, par2):
> isinstance(var1, str)
> isinstance(par1, str)
> isinstance(par2, str)
>
> Note that this was implemented primarily for another use case, so this probably
> won't be the recommended way of doing things if we implement support for other
> type hints but it works now. I'm personally not a fan of having multiple files
> for one module.
>
> Cheers,
>
> John
I have found that using .pi files i can declare name and type of variables not
declared in the same module but from a different part of the program and
autocomplete and type detection works with the .pi file, for example:
test.py:
var1 = ""
#var2 = ""
test.pi:
var2 = -1
After reanalyze test.py i can use in other parts of the program:
import test
test.var.. (and wing gives me the two options with the correct types.)
Do i have a way to do the same but inside an object? something like:
test2.py
class test(object): pass
variable = test()
test2.pi:
variable.runtime_tuple = ()
and from other code:
import test2
test2.variable.runti..... (autocomplete)
I have tried any differentes ways but still i only get autocompleted __class__
and __init__ from the object.
Regards,
Miguel Angel.
More information about the wingide-users
mailing list