2 ms·
This is also perfectly valid c: main() { printf("Hello world"); } Some details are hidden by the compiler, but Python isn’t exactly pure machine la
by fijiaarone 5y ago
This is also perfectly valid c:
main()
{
printf("Hello world");
}
Some details are hidden by the compiler, but Python isn’t exactly pure machine language either.
Semicolons and bracket are conceptually equivalent to significant white space (but more obviously explicit) and main is also a concept in Python (that is much more syntactically brutal than even its verbose c equivalent) that is hidden by the interpreter — which you also have to explain to beginners.
Compare with Python:
import sys
def main(args):
print("hello %s" % (args[0]))
sys.exit(0)
if __name__ == "__main__":
main(sys.argv[1:])
Which (of course) breaks when cut and pasting online