Ask Your Question
3

Why does mypy and the "apply" function of "Series" reject the use of "set[Any]" as a return object?

asked 2021-08-06 11:00:00 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-07-21 00:00:00 +0000

djk gravatar image

The reason why mypy and the "apply" function of "Series" reject the use of "set[Any]" as a return object is because "set[Any]" is not a valid return type. "set[Any]" is an ambiguous type that could contain any possible value, which creates uncertainty about what the function actually returns.

Instead, you should use a more specific type or define a custom type that represents the set of values you expect to be returned. This will help mypy and other tools to check and enforce type correctness in your code.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-08-06 11:00:00 +0000

Seen: 16 times

Last updated: Jul 21 '21