Main differences


Staff member
  1. The random.randrange(a, b) function, which returns a random number n in the range a <= n < b, and the random.randint(a, b) function, which returns a number in the range a <= n <= b, have been combined into a single function which takes one argument of type "range" (in 11l the range for a <= n <= b is written as a..b, while the range for a <= n < b is written as a.<b).
  2. The match() regular expression object method has been replaced by fullmatch() (in other words, fullmatch() in Python corresponds to match() in 11l).
  3. The re.split and re.sub functions have been moved from the re module into the overloaded string methods split and replace respectively.
  4. The gettempdir() function from the tempfile module and some functions from the os module (listdir, walk, mkdir, makedirs, remove, rename, etc.) have been moved to a separate fs module; the functions from the os.path have been moved to fs:path.
  5. 11l has two modules instead of the heapq module: minheap (equivalent to heapq) and maxheap, which has no direct equivalent in Python.
  6. The bin and hex functions return a string without the 0b or 0x prefix, because the unprefixed string is more often what is wanted (1, 2, 3, 4, 5, 6, 7, 8, 9).
  7. "\n".join(arr) in Python corresponds to arr.join("\n") in 11l (and in 11l the elements of arr can be not just strings, as in Python, but any objects for which conversion into a string is defined).
  8. map(lambda x: x * 2, filter(lambda x: x % 2 == 0, [1, 2, 3, 4])) in Python corresponds to [1, 2, 3, 4].filter(x -> x % 2 == 0).map(x -> x * 2) in 11l.
Last edited: