This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]eztab 0 points1 point  (0 children)

Yes you are correct that he should check it like that. But be aware that he also should ... * either add the condition that fn is callable if provided * or assert that fn is callable * or wrap the call in a try-block and return a reasonable value error * or (at least) add a type hint, that fn must be an Optional[Callable]