Class function conversion should also respect type annotation
hyangda opened this issue · 0 comments
hyangda commented
When using functions to define attributes, the implicit coercion always takes priority:
def COERCION_TEST(cls):
return 123
def COERCION_TEST(cls) -> str:
return 123
def COERCION_TEST(cls):
return '123'
def COERCION_TEST(cls) -> str:
return '123'
all result in
>>> import config
>>> type(config.Configuration.COERCION_TEST)
<class 'int'>
Could we instead have the function return type annotation set the type, similarly to variables?
Thanks 😄