1. 25
  1.  

  2. 5

    I wonder how many versions of this article with pretty much the same examples and code exist by now…

    1. 4

      Strings do some similar things. 1-character strings and strings that appear in source code are interned.

      RichardB@kallisti ~$ cat argvpairs.py 
      import sys
      
      for (ai, a) in enumerate(sys.argv[1:]):
          for (bi, b) in enumerate(sys.argv[2 + ai:]):
              print (1 + ai, a, 2 + bi, b, a is b)
      RichardB@kallisti ~$ python argvpairs.py ha ha a a
      (1, 'ha', 2, 'ha', False)
      (1, 'ha', 3, 'a', False)
      (1, 'ha', 4, 'a', False)
      (2, 'ha', 2, 'a', False)
      (2, 'ha', 3, 'a', False)
      (3, 'a', 2, 'a', True)
      
      1. 4

        Sometimes I don’t know how the world turns with referential opacity.

        1. 3

          This is pretty standard in most of the OO languages I’ve encountered. Also mentioned in good books about python.