Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What you're seeing here is an optimization about integers, not about pass by value. CPython only does this for small integers:

  $ python -c "print(int('3') is int('3'))"
  True
  $ python -c "print(int('300') is int('300'))"
  False
Other implementations make different choices.


Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: