Hacker News new | ask | show | jobs
by samfriedman 3078 days ago
Including the shebang and encoding at the top, using stdout for some reason, handling all the color formatting in one dense string...

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.

1 comments

This is absolutely what they're doing. It condenses quite easily even to:

    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.

And yet, the example correctly points out that Python, while a suitable choice, is not the ideal choice when it comes to programming for kids. Classroom time is precious, and kids need to be able to get right into the meat of things. Things that are easy for us to grok, like imports and functions vs methods, are tough for raw beginners. And _no_ kid should be forced to contend with ANSI escape sequences!

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.
One could argue that Fuze - a commercial programming language - is a bunch of extra gunk versus the free, open source and widely available alternative of almost any other language.

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.

The sad thing is, I'd bet that the developer first turned in something like what you've written, but was then asked to "make it more complex".

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.