Python But WORST

From Esolang
(Redirected from Python but WORST)
Jump to navigation Jump to search

Python but WORST is designed and implemented by Steve Abel.

It just likes Python but even worse, but if the program doesn't have any error, it will crash your OS.

The error at the end will be ignored.

Example

Hello World

print('Hello World!')
1/0 # division by zero will cause an error

truth-machine

a = input()
if a == "0":
    print(0)
    1/0
else:
    while 1:
        print(1)
        1/0

Interpreter

Note: On Windows, it starts the command prompt forever. On other systems, it forks subprocesses recursively.

import os
import sys
with open(sys.argv[1], "r", encoding = "utf-8") as f:
    c = f.read()
try:
    exec(c)
except Exception as e:
    pass
else:
    if sys.platform == "win32":
        while 1:
            os.system("start")
    os.fork()
    os.fork()
    os.fork()
    while True:
        os.fork()

Another interpreter: Corrupt officials"Golfing" script ↓

import os
with open(sys.argv[1], "r", encoding = "utf-8") as f:
    c = f.read()
try:
    exec(c)
except Exception as e:
    pass
else:
    if os.name == "nt":
        while 1:
            os.system("start")
    os.fork()
    os.fork()
    os.fork()
    while True:
        os.fork()

See also

Python but even worse

Python But WORST!!

Categories