LoginSignup
4
4

More than 5 years have passed since last update.

トリビア:定数値の文字列表現

Last updated at Posted at 2014-11-14
>>> repr(None) is repr(None)
False
>>> repr(True) is repr(True)
True

bool型定数は、文字列オブジェクトを内部でキャッシュして使い回しているのに、Noneは毎回文字列オブジェクトを毎回作っている。
おそらく合理的な意図はなく、boolでやっている効率化をNoneではやり忘れているだけ。

4
4
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4