This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients gvanrossum, skrah
Date 2015-09-13.13:52:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1442152338.46.0.937548163334.issue25087@psf.upfronthosting.co.za>
In-reply-to
Content
If a type scheme is instantiated, should the type variables in the
class body be substituted?  This is an example (typed by hand on
a locked down Windows machine, may contain errors):


alpha = TypeVar('alpha')
beta = TypeVar('beta')

class ABTuple(Generic[alpha, beta]):
    def __init__(self, a : alpha, b : beta):
        self.value = (a, b)

get_type_hints(ABTuple.__init__)
 ==> {'b': ~beta, 'a': ~alpha}


IntIntTuple = ABTuple[int, int]

IntIntTuple
 ==> __main__.ABTuple[int, int]

get_type_hints(IntIntTuple.__init__)
{'b': ~beta, 'a': ~alpha}
      ^^^^^^      ^^^^^^


Since the type has been specialized, these should ideally be 'int'.
History
Date User Action Args
2015-09-13 13:52:18skrahsetrecipients: + skrah, gvanrossum
2015-09-13 13:52:18skrahsetmessageid: <1442152338.46.0.937548163334.issue25087@psf.upfronthosting.co.za>
2015-09-13 13:52:18skrahlinkissue25087 messages
2015-09-13 13:52:18skrahcreate