#But you will admit it's more brittle

1 messages ยท Page 1 of 1 (latest)

analog zinc
#

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.

wispy night
#

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.

analog zinc
#

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. ๐Ÿ˜‰

wispy night
#

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.

analog zinc
#

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.

wispy night
#

Mostly in fire fighting meetings because it didn't.

analog zinc
#

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.

wispy night
#

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.

analog zinc
#

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.

wispy night
#

I'm not saying python is bad, but if it had braces, it would be better ๐Ÿ˜‰

#

Same for yaml.

analog zinc
#

lmao... hahaha fair enough ๐Ÿ˜‰

#

Who knows... Python4 might. Supposedly there's some real interesting changes being discussed for it.

wispy night
#

Python devs putting in braces? Not in a month of sundays. Might as well expect people to hang up a crucifix in a mosque.

analog zinc
#

Let's just say this isn't the first time I've heard this argument against Python ๐Ÿ˜„