One could imagine an even smaller subset interpreter. It's an interpreter for a subset of Python, consisting only of the programs that print "Hello World". Since it doesn't do any error checking, for all other programs the output is undefined. Implementing it is very simple: Just ignore the input file, and print "Hello World". As a bonus, it's an interpreter for the subset of "Hello World" programs in all other programming languages too!
(It should be noted that these are all joke esolangs. There are actual languages on the wiki that are very interesting though - I would definitely recommend you take them out!)
Yeah the amount of Python code that would work here is probably not a lot more than this specific FizzBuzz example. Lots of shortcuts taken, which I guess is understandable.
Comments
I was very disappointed that this is “interpreting” some tiny made up language.
This is not Python, or even within three orders of magnitude of Python.
It’s true, the title should have said “Python-like”
I like python subset. However, many don't see it that way.
You're right, mathematically it's undeniably true. However...
One could imagine an even smaller subset interpreter. It's an interpreter for a subset of Python, consisting only of the programs that print "Hello World". Since it doesn't do any error checking, for all other programs the output is undefined. Implementing it is very simple: Just ignore the input file, and print "Hello World". As a bonus, it's an interpreter for the subset of "Hello World" programs in all other programming languages too!
</tongue-in-cheek>
This has actually been done:
https://esolangs.org/wiki/Hello
While quines (programs that print their own source code) aren't possible in Hello, there's a version that makes it possible:
https://esolangs.org/wiki/Hello_Plus_Plus
And if you say the original isn't good enough because it can't do anything else... well, esolangs have you covered there too:
https://esolangs.org/wiki/HQ9_Plus
(It should be noted that these are all joke esolangs. There are actual languages on the wiki that are very interesting though - I would definitely recommend you take them out!)
I obviously meant "check them out" here. I was using speech recognition and it clearly misheard what I said.
I'd edit, but it's been long enough since I posted that HN isn't offering that option for this comment any more.
It's not a subset of python.
For instance this program works in this interpreter, but not in python:
That isn't part of the language though. That's just input that it doesn't handle properly. The author acknowledged it lacks error handling.
TBF the fizzbuzz code works just fine in CPython.
Indeed, for some code, CPython and this interpreter produce identical output. I gave it an upboat.
Yeah the amount of Python code that would work here is probably not a lot more than this specific FizzBuzz example. Lots of shortcuts taken, which I guess is understandable.