Is this use of isinstance pythonic/“good”?

前端 未结 4 1834
囚心锁ツ
囚心锁ツ 2021-02-02 01:41

A side effect of this question is that I was lead to this post, which states:

Whenever isinstance is used, control flow forks; one type of object goes dow

4条回答
  •  盖世英雄少女心
    2021-02-02 02:12

    The first use is fine, the second is not. Pass the argument to int() instead so that you can use number-like types.

提交回复
热议问题