A long time ago I made a Tumblr that showed off <> parts of programming languages. This was inspired by the wonderful presentation by Gary Bernhardt. Content from that Tumblr has been transplanted here, and improved with hidden results so each wat can be revealed incrementally.

Python 2

These only work in Python versions starting with 2. Such versions are now dead.

def less_than(left, right):
    if (left < right) == True:
        return True
    else:
        return False

print(less_than(100, 1))
False = True
print(less_than(100, 1))
Output
False
True
x = "top"
print(list("a" for x in (1,2)), x)
print(["a" for x in (1,2)], x)
Output
(['a', 'a'], 'top')
(['a', 'a'], 2)
my_str = "not in class"
class C:
    my_str = "in the class"
    print([my_str for i in (1,2)])
    print(list(my_str for i in (1,2)))
Output
['in the class', 'in the class']
['not in class', 'not in class']

Python 3

These work in python2 as well as modern python3.

def my_append(item, lst = []):
    lst.append(item)
    return lst

print(my_append(1))
print(my_append(5, [3, 1, 4, 1]))
print(my_append(1))
Output
[1]
[3, 1, 4, 1, 5]
[1, 1]
my_str = "not in class"
class wat:
    my_str = "in the class"
    print(repr(my_str))
    print(repr((lambda: my_str)()))
Output
'in the class'
'not in class'
my_str = "outside func"
def func():
     my_str = "inside func"
     class C():
         print(repr(my_str))
         print(repr((lambda:my_str)()))
         my_str = "inside C"

func()
Output
'outside func'
'inside func'
my_str_1 = "1: outside of func"
my_str_2 = "2: outside of func"
def func_1():
    my_str_1 = "1: inside func_1"
    my_str_2 = "2: inside func_1"
    def func_2():
        print(my_str_1)
        print(my_str_2)
        my_str_1 = "1: inside func_2"
    func_2()

func_1()
Output
Traceback (most recent call last):
  File <stdin>, line 1, in <module>
  File <stdin>, line 8, in func_1
  File <stdin>, line 5, in func_2
UnboundLocalError: local variable my_str_1 referenced before assignment
my_str_1 = "1: outside of func"
my_str_2 = "2: outside of func"
def func():
    my_str_1 = "1: inside the func"
    my_str_2 = "2: inside the func"
    class C:
        print(my_str_1)
        print(my_str_2)
        my_str_1 = "1: inside the class"

func()
Output
1: outside of func
2: inside the func
REPL:
list() == []
Output
True
set() == {}
Output
False
set("w") == {"w"}
Output
True
set("wat") == {"wat"}
Output
False
set(("wat")) == {"wat"}
Output
False
set(("wat",)) == {"wat"}
Output
True

Perl

if (0) {
 use constant E => 2.17 ;
}
print E ;
Output
2.17
if ("alice" == "bob") {
    print "uh-oh!"
}
Output
uh-oh!

Javascript

REPL:
>var wat = new Object()
Output
undefined
>wat.lol
Output
undefined
>lol
Output
ReferenceError: lol is not defined
[9,900,40].sort()
Output
[40, 9, 900]

PHP

Some only apply to certain versions of PHP. 3V4L was used to test all versions of PHP.

Versions 4.3.0 - 7.3.33
$arg = 'F';
$word = (($arg == 'F') ? 'foo':
         ($arg == 'B') ? 'bar':
         'baz');

echo $word;
Output
bar
Lack of additional parentheses is deprecated in 7.4.0 - 7.4.33 and an error in 8.0.0 and above
Versions 4.3.0 - 7.4.33
var_dump(TRUE == "wat");
Output
bool(true)
var_dump("wat" == 0);
Output
bool(true)
note: for version 8.0.0 and above this is `bool(false)`
var_dump(TRUE == 0);
Output
bool(false)
Versions 5.0.0 - 5.6.40
function foo(string $s) {}
foo("hello world");
Output
Catchable fatal error: Argument 1 passed to foo() must be an instance of string, string given, called in /in/5KV95 on line 5 and defined in /in/5KV95 on line 4

Process exited with code 255.
No error is raised for versions above 5.6.40
var_dump(NULL < -1);
var_dump(NULL == 0);
Output
bool(true)
bool(true)
Versions 4.3.0 - 5.4.3
var_dump("99999999999999999999999999999999" == "99999999999999999000000000000000");
Output
bool(true)
Output is `bool(false)` for versions above 5.4.3
Versions 4.3.0 - 5.1.6
var_dump(date('F', strtotime('February')));
Output Versions 4.3.0-5.0.5
string(8) "December"
Output Versions 5.1.0-5.1.6
string(7) "January"
Output is `string(8) "February"` for versions above 5.1.6
Versions 4.3.0 - 7.4.33
var_dump(42 == "42wat");
Output
bool(true)
Output is `bool(false)` for versions above 7.4.33
var_dump("42" == "042");
var_dump(42 == 042);
Output
bool(true)
bool(false)