Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python as First Langauge
#9
The Zeller reference is a good read. I have some arguments against this page, however. (By the way, the page should be formatted for an easier read.)

He is exaggerating the complexity of Java and hiding the complexity of Python. After all, A Java source file is also only a text file. The compilation step to a class is quite easy to get and the encapsulation is easy to understand even for starters. And Java has a "for x in v" too. Also, using "Print x" to show how simply Python is, defeats the advertising effect since Java 3 abandoned that.

Some information is not correct. Python does no more pass by value than Java or any other language. It makes pointer implicit just a Java does. To understand the difference of "f(x)" for variables x and lists x is as hard as in any other language. What is printed in the following code and why?

v = list(range(5))
def f(v):
    v[4]=9
f(v)
print(v)

w = list(range(5))
def f(w):
    w=8
f(w)
print(w)
The code creates a warning message on "w=8", indeed, which is good. But why am I able to redefine f()? Is that a good idea to enforce clear and clean code?

Advocating for the lack of "the necessity to discuss the complex visibility and hiding modes of Java" is not something I support. It is indeed very easy to hide code errors by not being aware of those "complex" things and get programs that are very difficult to understand or maintain. Anyway, in this first course, the object-oriented approach will only on a basic level. But not understanding those things from the start may backfire later.

Finally, let me admit that the simplicity of the data declaration in Python attracts me. Lists in Java are just not that easy to create. And tuples do not exist. You will have to use lists for this Java code.

v = (2, 4.5, "ape")
for o in v:
    print(o)
Translates to:

		Object v[] =
		{
			3, 4.5, "ape"
		};
		for (Object o : v)
			System.out.println(o);
I also admit that the simpler syntax is easier for beginners. It is also nice to enforce a strict structure in the code. I have seen examples of unreadable Java from beginners. But modern IDEs reformat the code, so this is not that much of an issue.

I am not so convinced about the lack of compile-time checking and variable declarations even for beginners. It is so easy to write "i=..." instead of "j=...", and the resulting errors are very hard to find. In typed languages, "j" would be simply undefined. The Spyder IDE not even claims about unused but assigned variables in a Python file besides in functions.

I am writing all this not because I don't not like the ideas behind Python. Partly, I am doing this to create a discussion, but mostly, to convince myself that there could be some reasoning behind sticking with Java.
Reply


Messages In This Thread
Python as First Langauge - by mga010 - Jul-02-2020, 10:09 AM
RE: Python as First Langauge - by Larz60+ - Jul-02-2020, 11:03 AM
RE: Python as First Langauge - by Gribouillis - Jul-02-2020, 11:26 AM
RE: Python as First Langauge - by ndc85430 - Jul-02-2020, 11:53 AM
RE: Python as First Langauge - by mga010 - Jul-02-2020, 03:04 PM
RE: Python as First Langauge - by Larz60+ - Jul-02-2020, 03:16 PM
RE: Python as First Langauge - by Gribouillis - Jul-02-2020, 06:34 PM
RE: Python as First Langauge - by perfringo - Jul-02-2020, 07:39 PM
RE: Python as First Langauge - by mga010 - Jul-04-2020, 02:33 PM
RE: Python as First Langauge - by snippsat - Jul-04-2020, 10:52 PM
RE: Python as First Langauge - by mga010 - Jul-05-2020, 05:34 PM
RE: Python as First Langauge - by voidptr - Jul-25-2020, 04:59 AM
RE: Python as First Langauge - by Larz60+ - Jul-25-2020, 02:00 PM
RE: Python as First Langauge - by mga010 - Jul-27-2020, 04:03 PM
RE: Python as First Langauge - by Gribouillis - Jul-27-2020, 04:30 PM
RE: Python as First Langauge - by mga010 - Jul-28-2020, 04:46 PM
RE: Python as First Langauge - by Larz60+ - Jul-29-2020, 12:08 AM
RE: Python as First Langauge - by voidptr - Aug-02-2020, 07:02 AM
RE: Python as First Langauge - by millpond - Jul-31-2020, 06:49 AM
RE: Python as First Langauge - by elenaflorence87 - Jul-31-2020, 12:20 PM
RE: Python as First Langauge - by anne - Jul-31-2020, 06:06 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020