Polyglot CheatSheet - Others
Updated: 2020-06-29
Python
# with new line
print("1")
# without new line
print("1", end='')
pprint
can pretty-print arbitrary Python data structures
>>> import pprint
>>> pp = pprint.PrettyPrinter(indent=4)
>>> pp.pprint(foo)
Java
// with new line
System.out.println()
// without new line
System.out.print()
Get HashCode
Python
Python's hash is randomized, the hash value stays the same in one process, but will change in another invocation.
>>> hash("asdf")
-6638445151105855253
>>> hash("asdf")
-6638445151105855253
# Restart
>>> hash("asdf")
5905973160914177863
Java
Integer.valueOf(value.hashCode());