2018.2 type hint error at debug runtime?
I have a function which when I look at Quick Documentation gives me the suggested typehint of OrderedDict[str, str], yet when I manually add that typehint I run into an error at debug runtime.
def lastword(s:str) -> str:
a = s.strip('?').split()[-1].split('/')[-1]
return a
def createOrderdDict(q1:str, q2:str, q3:str, q4:str, q5:str):
answers = OrderedDict([
(q1, lastword(q1)),
(q2, lastword(q2)),
(q3, lastword(q3)),
(q4, lastword(q4)),
(q5, lastword(q5)),
])
return answers

def createOrderdDict(q1:str, q2:str, q3:str, q4:str, q5:str) -> OrderedDict[str, str]:
answers = OrderedDict([
(q1, lastword(q1)),
(q2, lastword(q2)),
(q3, lastword(q3)),
(q4, lastword(q4)),
(q5, lastword(q5)),
])
return answers
Any idea what is going on here?
Please sign in to leave a comment.
