Type hints when unpacking a tuple?

后端 未结 1 642
-上瘾入骨i
-上瘾入骨i 2020-12-09 07:39

Is it possible to use type hinting when unpacking a tuple? I want to do this, but it results in a SyntaxError:

from typing import Tuple

t: Tup         


        
相关标签:
1条回答
  • 2020-12-09 08:21

    According to PEP-0526, you should annotate the types first, then do the unpacking

    a: int
    b: int
    a, b = t
    
    0 讨论(0)
提交回复
热议问题