How to specipy :rtype is derived type?

like in:

import copy
class X(object):
    Seems like this is not the right way
    :type self : T
    :rtype : T  
    def Foo(self):
        foo = copy.copy(self)
        return foo

class Y(X):
    def __lshift__(self, other):
        self.other = other

bar = Y()
bar << "Bar" # no warning here
foo = Y().Foo()
foo << "Foo" # unexpected "Statement seems to have no effect"

Please sign in to leave a comment.