Reputation: 1241
I was just playing around with the __annotations__
function and I tried this -
def function() -> float:
print('I always return a `float` type data!')
the output of print(function.__annotations__)
is {'return': float}
.
How can I make it print {'return': <class 'float'>}
Upvotes: 0
Views: 64
Reputation: 2518
maybe you need to update your python version.I'm using python 3.7.7,it works fine to me
code:
def function() -> float:
print('I always return a `float` type data!')
print(function.__annotations__)
result:
{'return': <class 'float'>}
Upvotes: 1