@s_gruppetta These are all compelling arguments. I agree, and use Python in my no-prerequisite first-year seminar.
One counterpoint I'll make is that Python's error messages can be more cryptic than, say, Java's. I've had students use the wrong kind of brackets with a list comprehension and get something like this:
(x**2 for x in range(10))[3]
<input>:1: SyntaxWarning: 'generator' object is not subscriptable; perhaps you missed a comma?
<input>:1: SyntaxWarning: 'generator' object is not subscriptable; perhaps you missed a comma?
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
TypeError: 'generator' object is not subscriptable
@peterdrake although this one is clearly **not** fixed in 3.10, or 3.11! Maybe in 3.12?! - Having said that, the missing comma only comes out in the one-liner version, and not if the generator is assigned to a variable name
But yes, error messages are not Python's strongest feature!
@peterdrake in fact, this is what comes out in 3.11 when running that line in a script:
`(x**2 for x in range(10))[3]`
`Traceback (most recent call last):`
`File` `"/Users/stephengruppetta/PycharmProjects/Testing/test.py", line 1, in <module>`
`(x**2 for x in range(10))[3]`
`~~~~~~~~~~~~~~~~~~~~~~~~~^^^`
`TypeError: 'generator' object is not subscriptable`
@peterdrake PS: That needs 3.11
@s_gruppetta Ah, that is more helpful. I mean, you still need to know what a generator object is, but at least it points to the location of the problem.
@peterdrake True, although have you seen the latest improvements in error messages (in 3.10 and 3.11), the Python core team is doing some great work on that (as well as speed)