#But you will admit it's more brittle
1 messages ยท Page 1 of 1 (latest)
Yes and no. Compared to Java and C, it can be more brittle, but the Python interpreter has gotten WAY better over the years. And with the additions of type casting/checking and such, it's not nearly as bad as it was with Python 2.x. Plus, a proper linter will point all that out anyhow.
Ok, consider the following example:
for i in range(1, 11):
square = i * i
cube = i * i * i
factorial = math.factorial(i)
print(f"Number: {i}")
print(f"Square: {square}")
print(f"Cube: {cube}")
print(f"Factorial: {factorial}")
print("-" * 20) ```
versus this one:
import math
for i in range(1, 11):
square = i * i
cube = i * i * i
factorial = math.factorial(i)
print(f"Number: {i}")
print(f"Square: {square}")
print(f"Cube: {cube}")
print(f"Factorial: {factorial}")
print("-" * 20) ```
No linter in the world will find that error.
Ah, yeah, that's correct. I see what you mean there. That would go unnoticed.
But I would flog the developer that didn't unit test that method as well. ๐
you'd go through a lot of whips very quickly, and your arm would fall off.
see, if they'd put in an end statement or something, I would not hear a word against it. But they didn't, because it's essentially a language deliberately designed for quick and dirty coding.
Nah... lol I've been doing python dev work for about the past 15 years now and worked with a lot of developers. Stuff like that would come out during a code sniff/code review/test run.
And yeah, but that's also the draw of Python too. I can write a quick script to update hundreds of thousand of DB rows in about 15 minutes. Run that by a peer and a quick unit test with it and it's golden.
I'm not saying you're wrong at all, but stuff like that should be caught by even the most newb of devs.
You see, I am a little congested when it comes to "should", because I've head that way too often.
Mostly in fire fighting meetings because it didn't.
Yeah, fair. I don't disagree with that ๐ But in my experience things like that have always been caught in a code review or test. If you're not doing TDD, you're doing it wrong, imho.
You are saying you can save a lot of time in writing your code, but you have to invest that time again in extra testing, regression and review. I'm pretty sure in the long run, a more stringently structured language takes the cup effort wise, even if the investment in initial development and change is a tiny bit higher.
Yeah, but using TDD solves a lot that though. Writing the test first and then the code to the test saves a LOT of time and issues.
Plus, there are just some things that Python is better at compared to other languages, specifically data engineering. For that, nothing else can really touch Python. I mean, I guess R or F# might come close.
I'm not saying python is bad, but if it had braces, it would be better ๐
Same for yaml.
lmao... hahaha fair enough ๐
Who knows... Python4 might. Supposedly there's some real interesting changes being discussed for it.
Python devs putting in braces? Not in a month of sundays. Might as well expect people to hang up a crucifix in a mosque.
Let's just say this isn't the first time I've heard this argument against Python ๐