[wingide-users] Silly question about the parameters

Cesco dev at cesco.it
Mon Mar 7 01:15:46 MST 2011


Il giorno 02/mar/2011, alle ore 18.31, Wingware Support ha scritto:
> Yes, just write this:
> 
> def getHour(mydate):
>    isinstance(mydate, datetime.datetime)
>    mydate. <- will show completions for datetime.datetime instance
> 
> Wing's static analysis and type inferencing engine sees and understands this kind of use of isinstance in your code so you do not need to be debugging to get the completions.


And what if I have to pass a list of objects to a function?

For example:

class myClass:
    def __init__(self, P_value):
        self.value = P_value

l = []
l.append(myClass("Tom"))
l.append(myClass("Dick"))
l.append(myClass("Harry"))

def writeValues(P_list):
    """ How do I declare that P_list is a list of myClass ? """
    for element in P_list:
        print(element.value)

writeValues(l)


Many thanks


More information about the wingide-users mailing list