by ajford · 8y ago · 0 comments
They write the "print" statement like it's damn Java. A simple `print(outstring)` would have been sufficient, instead of two lines of Java-esque sys.stdout.write nonsense.
Not to mention something like `colored` and `colorama` or `click` would solve the colored text thing. Though I'll admit having globals like INK and PAPER makes things a bit more intuitive for kids.
But the fact that they go out of their way to make the Python example more intimidating is a little... annoying.
This smacks of the writers trying to intentionally make their comparison language look obtuse. A pattern I've seen elsewhere and am never a fan of.
import random
import time
while True:
col = random.randint(30, 48)
print("\x1b[{}m{}\x1b[0m".format(col, "Hello World"))
time.sleep(1)
Which is still pretty obtuse, but the "random colours" task seems hand-picked to penalize Python.It neglects to mention that Fuze has virtually no utility beyond an educational curio, too, versus Python which is used for many, many things.
More appropriate would be to compare with some Python programming kit that had similar graphic environment abstractions:
fontsize(4)
while True:
ink = rndcolor()
paper = rndcolor()
text("Hello, world!")
sleep(1)
But even then, unless you wrap Python with something that handles imports/globals/etc for you (a la Processing), doing this in Python is still going to take a bunch of extra gunk.But you're right, a fairer comparison would be against a Python learning environment that sweeps some of the cruft and gotchas under the rug, and complexity is very tough for beginners.
Speaking from experience running and helping in workshops, I found a lot of Python learners would name their code "somemodule.py" after the module they're learning about, and this would subsequently break "import somemodule". So there's a lot of merit in "safer" environments.
I'd like to see a satire done in a code-golf style: you think writing a line to a file in Python is easy? Think again, after you read this 400-character line of lambdas, string interpolation, and chained ternary operators!
Assembly code could be made to look like the sane alternative at the (il)logical extreme.