News for hackers. Stuff that matters.
Re:Why Python keeps growing, explained by throwawayjdk81 on Friday March 03, 2023 @05:27AM (#35007863)
The example they give later in the article is also pretty verbose and includes much more "magic" than Java

Example:

  import antigravity

  def main():
    antigravity.fly()

  if __name__ == '__main__':
    main()
I would argue that there is nothing simple about the last if-statement and will probably be very confusing for new developers.
Re:Why Python keeps growing, explained by dragonwriter on Friday March 03, 2023 @05:43AM (#35007960)
> I would argue that there is nothing simple about the last if-statement and will probably be very confusing for new developers.

The only thing that isn’t perfectly straightforward is “what is __name__”, but once you know how __name__ is defined…

OTOH, that example is much more complicated than needed. As a simple executable script, that would do the same thing if antigravity. Fly() actually did anything, all that is needed is:

  import antigravity

  antigravity.fly()
The rest is unnecessary boilerplate to provide a module that can operate either as a library or a script, which is superfluous here. Moreover, since the actual functionality it is demonstrating is all in an import hook, all you actually need (the rest just produces an error message) is:

  import antigravity