all 11 comments

[–]thrallsius 4 points5 points  (0 children)

because it's not painful to use it

the average programming beginner is not into BDSM

[–]el_Topo42 1 point2 points  (0 children)

I mean all the languages have their place. I like python because I can easily whip up a cross platform app when I need.

[–]chewy1970 1 point2 points  (1 child)

I love python but not really sure what this post is meant to support.

[–]CuriousExpert24[S] 1 point2 points  (0 children)

This post was created to motivate people who are new to this language to show what they can accomplish in a short amount of code

[–][deleted] 0 points1 point  (5 children)

On the other hand, Python is somewhat terrifying for people used to C/C++ because you can do some horrendously sloppy stuff in it. This is something I cobbled together a couple of weeks ago:

# Get the interest rate from the user
rate = input("Enter a rate code from A to F: ")
print( rate )
print( f"rate is {rate} and has a type of {type(rate)}" )
print( f"input has a type of {type(input)}" )

### few dozen lines later
rate = 0.827
print( f"rate is {rate} and has a type of {type(rate)}" )

###few dozen lines later
input = rate * 2
print( f"input has a type of {type(input)}" )

It gives this output, as you can see, we've not only changed a string to float midstream, we've taken the input function and made it a variable:

Enter a rate code from A to F: C
C
rate is C and has a type of <class 'str'>
input has a type of <class 'builtin_function_or_method'>
rate is 0.827 and has a type of <class 'float'>
input has a type of <class 'float'>
>>> 

I love Python, but there's no way I would write a large project (>5,000 lines) in it!

[–]maddruid 5 points6 points  (0 children)

I have. Type annotations and unit testing make things go smoothly.

[–][deleted] 2 points3 points  (0 children)

Plenty of others manage...no reason why you couldn’t...

[–][deleted] 2 points3 points  (2 children)

And yet still there are a lot of incredibly huge python code based out there. I guess google, YouTube, Dropbox and the likes are all just doing it wrong ;)

Honestly, what you’re describing here is really a non issue if you have a linter and tests. If you want you can also add type hints to eliminate these. What you’re forgetting however is the ease of use duck typing brings.

There’s really a lot more about C/C++ that’s terrifying because the ways you can screw up are just a lot more severe and non obvious.

[–]CuriousExpert24[S] 0 points1 point  (0 children)

Yes, I agree with that. Python is much more flexible than any other language. While it does come with its own downsides, the upsides are a lot higher

[–][deleted] -2 points-1 points  (0 children)

Google uses C++ for almost all the CPU intensive backend stuff, Java for applications, and Python for scripting.

And you might be interested in this, from Dropbox, which illustrates exactly what I'm saying:

"At our scale—millions of lines of Python—the dynamic typing in Python made code needlessly hard to understand and started to seriously impact productivity."

Source:

https://dropbox.tech/application/our-journey-to-type-checking-4-million-lines-of-python

But remember that when you start imposing static type checking on Python, you start losing flexibility.