3 ms·
All dynamically typed languages with implicit coercion will have similar-looking tables: PHP: http://www.blueshoes.org/en/developer/php_cheat_sheet http://www.
by userbinator 12y ago
All dynamically typed languages with implicit coercion will have similar-looking tables:
PHP: http://www.blueshoes.org/en/developer/php_cheat_sheet http://www.blueshoes.org/en/developer/php_cheat_sheet
Perl: http://qntm.org/equality http://qntm.org/equality
Python: http://i.stack.imgur.com/Ya0Ux.png http://i.stack.imgur.com/Ya0Ux.png (I don't think all the entries are correct)
- name_censored_ 12y ago> Python: http://i.stack.imgur.com/Ya0Ux.png http://i.stack.imgur.com/Ya0Ux.png (I don't think all the entries are correct Python checks out; >>> b=[True,False,1,0,-1,"","True","False","1","0","-1",None,[],{},[[]],[0],[1]] >>> for x in b: ... print [int(y == x) for y in b] ... [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
- userbinator 12y agoI see the problem - the empty string is in a different position between the rows and columns, leading to "" being equal to the string "True", which is false.
- tckr 12y agoIt's part of the official docs: http://php.net/manual/en/types.comparisons.php http://php.net/manual/en/types.comparisons.php