4 ms·
You don't "need" any of the entry points when you are beginning Python. print("Hello World") is a perfectly valid and runnable Python code. And when you are w
by elevatedastalt 3y ago
You don't "need" any of the entry points when you are beginning Python.
print("Hello World") is a perfectly valid and runnable Python code.
And when you are working on a small part of a large code base, you usually don't care about __main__ either. So yes, it's complexity but it's complexity that you don't need to encounter right away.
Python is intuitive off the bat. public static void main(String[] args) is not.
- int_19h 3y agoInterestingly, C# (which began its life as a sort of Java/Delphi crossover syntactically) agrees. It used to be that you had to write: class Program { static void Main() { Console.WriteLine("..."); } } But these days, we can just do: Console.WriteLine("...");
- rotifer 3y agoFWIW, in an upcoming version of Java you'll likely be able to do this: $ cat Hello.java void main() { System.out.println("Hello, world!"); } $ java --enable-preview --source 21 Hello.java 2>/dev/null Hello, world! $ This is currently a preview feature in Java 21 and 22.