Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by perrygeo

1 day ago

> small int (0-256) cached

It's -5 to 256, and these have very tricky behavior for programmers that confuse identity and equality.

  >>> a = -5
  >>> b = -5
  >>> a is b
  True
  >>> a = -6
  >>> b = -6
  >>> a is b
  False

2 comments

perrygeo

Reply

Tostino  20 hours ago

Java does similar. Confusing for beginners who run into it for the first time for sure.

fragmede  4 hours ago

wat

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities