We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Python but even worse

From Esolang
Jump to navigation Jump to search

Python but even worse is like Python, but it deletes its code if it doesn't raise an error.

In Python, if a wrong command is executed, it will raise an error, but in this esolang, the program will halt silently.

It's invented by User:None1.

Example Programs

Hello World

print("Hello World!")
print(x) # Note that X isn't defined

Cat Program

import sys
print(sys.stdin.read())
a = 1 / 0

FizzBuzz

for i in range(1,101):
    if i%3==0:
        print("Fizz",end="")
    if i%5==0:
        print("Buzz",end="")
    if i%3 and i%5:
        print(i,end="")
    print()
a = 6128576217835128956872345782136587236578132651872365823164821587623951293846125778123658723148712635231513279 / (0 / 0)

Interpreter in Python

import os,sys
with open(sys.argv[1],"r",encoding="utf-8") as f:
    c=f.read()
try:
    exec(c)
except:
    pass
    """
    Indicates that the error at the end is ignored
    """
else:
    os.remove(sys.argv[1])

Note that it is also possible to write an interpreter in C/C++ using Python C APIs.

See also