# Why Python over any other high level language?

**URL:** <https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913>\
**Category:** In My Humble Opinion\
**Created:** [December 21, 2022, 5:32pm UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913 "2022-12-21T17:32:36Z")\
**Posts on this page:** 18\
**Page:** 2

<div class="post-metadata">

**Author:** ![enipla](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@enipla](https://boards.straightdope.com/u/enipla)\
**Post date:** [December 23, 2022, 12:39pm UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/21 "2022-12-23T12:39:53Z")

</div>

> [@scabpicker](#):
>
> Simultaneously (and somewhat hilariously) I hate that indentations have meaning in the language.

This is what I mean by hating the structure.

---

<div class="post-metadata">

**Author:** ![enipla](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@enipla](https://boards.straightdope.com/u/enipla)\
**Post date:** [December 23, 2022, 12:41pm UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/22 "2022-12-23T12:41:43Z")

</div>

A heart on a license plate? Is that a thing in CA???

---

<div class="post-metadata">

**Author:** ![leahcim](https://avatars.discourse-cdn.com/v4/letter/l/b4bc9f/32.png) [@leahcim](https://boards.straightdope.com/u/leahcim)\
**Post date:** [December 23, 2022, 5:18pm UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/23 "2022-12-23T17:18:37Z")

</div>

> [@thelurkinghorror](#):
>
> Good point, I didn’t meant to imply that they’re all dynamic now, but there’s certainly more than 30 years ago. But there’s not a dozen different types of integer in these languages, I don’t think?

Rust has i8, i16, i32, i64, i128, u8, u16, u32, u64, and u128. Go has uint8, uint16, uint32, uint64, int8, int16, int32, and int64. They’re certainly still around in languages where it is expected to matter.

Maybe I’m hanging around with a different crowd these days, but it seemed like in 2005 there were a lot of people excited by python’s not having to specify types (see [xkcd: Python](https://xkcd.com/353/)) which was a barrier to entry for C/Java learning. But in 2015 there were a lot of people excited by Typescript/Dart/&c which added back the type system to dynamic languages for better maintainability. I.e. they were excited to get back what the 2005 peeps were excited to ditch.

---

<div class="post-metadata">

**Author:** ![thelurkinghorror](https://avatars.discourse-cdn.com/v4/letter/t/7c8e57/32.png) [@thelurkinghorror](https://boards.straightdope.com/u/thelurkinghorror)\
**Post date:** [December 23, 2022, 5:19pm UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/24 "2022-12-23T17:19:49Z")

</div>

Hearts, hands, stars, I think a plus sign but I don’t remember seeing one

---

<div class="post-metadata">

**Author:** ![brad\_d](https://avatars.discourse-cdn.com/v4/letter/b/50afbb/32.png) [@brad\_d](https://boards.straightdope.com/u/brad_d)\
**Post date:** [December 23, 2022, 5:22pm UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/25 "2022-12-23T17:22:43Z")

</div>

On a particular flavor of personalized plate (the “Kids Plate”), you can choose one of four special characters to appear in the number. (Heart, Star, Handprint, or Plus).

[DMV link](https://www.dmv.ca.gov/portal/vehicle-registration/license-plates-decals-and-placards/california-license-plates/special-interest-license-plates/)

The linked page doesn’t specifically say, but I believe I read that the special character is ignored for the purpose of uniqueness (meaning the pictured vehicle has a license number of “PTHON” for official purposes).

(Although upon closer inspection, the plate in the photo doesn’t look like a Kids Plate. Hmmmm…)

---

<div class="post-metadata">

**Author:** ![thelurkinghorror](https://avatars.discourse-cdn.com/v4/letter/t/7c8e57/32.png) [@thelurkinghorror](https://boards.straightdope.com/u/thelurkinghorror)\
**Post date:** [December 23, 2022, 7:29pm UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/26 "2022-12-23T19:29:07Z")

</div>

Correct

> **[If your license plate has a star or heart, how do you list that?](https://www.ocregister.com/2017/11/02/if-your-license-plate-has-a-star-or-heart-do-you-list-it/)**
>
> Q. Hi Honk: I am looking into getting personalized license plates, and I see that you can add a symbol, such as a heart, a star or a hand. If a form asks for your license-plate number, and you have…

---

<div class="post-metadata">

**Author:** ![Bullitt](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bullitt/32/5725_2.png) [@Bullitt](https://boards.straightdope.com/u/Bullitt)\
**Post date:** [December 24, 2022, 12:54am UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/27 "2022-12-24T00:54:50Z")

</div>

> [@enipla](#):
>
> A heart on a license plate? Is that a thing in CA???

Yes, and CA has four possible symbols: heart, hand, star, or plus sign.

(ETA — already answered above)

[![](https://i.imgur.com/N3kE16M.jpeg) ](https://i.imgur.com/N3kE16M.jpeg)

[![](https://i.imgur.com/Lrl9fq6.jpeg) ](https://i.imgur.com/Lrl9fq6.jpeg)

[![](https://i.imgur.com/h910ush.jpeg) ](https://i.imgur.com/h910ush.jpeg)

[![](https://i.imgur.com/4nZvUPn.jpeg) ](https://i.imgur.com/4nZvUPn.jpeg)

[![](https://i.imgur.com/OWY61XI.jpeg) ](https://i.imgur.com/OWY61XI.jpeg)

---

<div class="post-metadata">

**Author:** ![scudsucker](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/scudsucker/32/14101_2.png) [@scudsucker](https://boards.straightdope.com/u/scudsucker)\
**Post date:** [December 24, 2022, 4:34am UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/28 "2022-12-24T04:34:14Z")

</div>

> [@enipla](#):
>
> this VB programmer

The horror! The horror! The terrible memories…

I used to joke that C# amd Java used to steal each cool new features from each other, lambdas, generics etc.

But I currently code in Kotlin which has stolen all the cool shit from C#, Ruby, Python, and what it could get from Java (snerk). It is a great modern language, though I’m not so sure about the JVM

---

<div class="post-metadata">

**Author:** ![thelurkinghorror](https://avatars.discourse-cdn.com/v4/letter/t/7c8e57/32.png) [@thelurkinghorror](https://boards.straightdope.com/u/thelurkinghorror)\
**Post date:** [December 24, 2022, 6:02am UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/29 "2022-12-24T06:02:57Z")

</div>

Hard on for you? I thought they’d reject that. Funny enough they state they only allow 69 if you drive a 1969 vehicle

---

<div class="post-metadata">

**Author:** ![thelurkinghorror](https://avatars.discourse-cdn.com/v4/letter/t/7c8e57/32.png) [@thelurkinghorror](https://boards.straightdope.com/u/thelurkinghorror)\
**Post date:** [December 24, 2022, 6:04am UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/30 "2022-12-24T06:04:54Z")

</div>

[VB.NET](http://VB.NET) or VB6? Some masochists loooove the latter. I’ve done .NET on and off since the beginning and feel like I have to use embarrassed hushed tones, but it’s not that bad or anything.

Ruby is Python for weebs

---

<div class="post-metadata">

**Author:** ![nate](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/nate/32/13085_2.png) [@nate](https://boards.straightdope.com/u/nate)\
**Post date:** [December 24, 2022, 9:38am UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/31 "2022-12-24T09:38:00Z")

</div>

It’s not that bad, in fact it’s great. The whole .NET system w/ Visual Studio and nuget is the best implementation of the respective functions there is. It is even cross-platform now which probably never was an actual complaint but a brand people could rally around to pick nits. In fact, I feel like the ones steering the ship on it are following the wrong path into something more complicated than it needs to be; the weird shit VS is pulling with the program.cs without namespace or classes is depressing. Who wanted that?

---

<div class="post-metadata">

**Author:** ![enipla](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@enipla](https://boards.straightdope.com/u/enipla)\
**Post date:** [December 24, 2022, 4:23pm UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/32 "2022-12-24T16:23:32Z")

</div>

Yeah. [VB.NET](http://VB.NET) w Visual Studio. And a ton of Javascript in there too. Still like it better than Python.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [December 27, 2022, 4:41am UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/33 "2022-12-27T04:41:01Z")

</div>

> [@suranyi](#):
>
> He once told me: “Anything that needs to be coded, I can do it in half the time in Python vs C++”.

The issue is that the execution time may be 100x longer. Multiple times now I’ve found myself rewriting a script (mostly in Perl, not Python, but same diff) simply because it would take hours to execute the script version on the dataset I care about.

And personally, I find that the productivity advantage of scripting languages is only there at a small scale. Past a certain point, the advantages of types and other compile-time constraints, not to mention the superiority of IDEs and debugging tools, tilts the advantage back in favor of compiled languages (C++ and C# being my preferred ones).

Even for small projects, I’ve sometimes found myself writing something in C++ simply because _I know I can be algorithmically lazy_ in C++ and get away with it, whereas in a scripting language I might have to try really hard to come up with a technique that fits in the performance and memory constraints.

---

<div class="post-metadata">

**Author:** ![CaveMike](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cavemike/32/16379_2.png) [@CaveMike](https://boards.straightdope.com/u/CaveMike)\
**Post date:** [December 27, 2022, 5:44am UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/34 "2022-12-27T05:44:15Z")

</div>

> [@Dr.Strangelove](#):
>
> The issue is that the execution time may be 100x longer.

Python is slow, but many apps use Python as a wrapper around native code. You end up with a native app that uses scripting as the top layer.

In machine learning and scientific computing Python is moving from a fancy configuration language to a DSL. They Python code that you write doesn’t do the work, it configures a pipeline that executes on GPU to do the work. Recent versions of TensorFlow inspect the Python source itself to automatically convert to pipeline code.

This type of code is well suited for Python because the line between compile time and run time is fuzzier. If your program is going to run the same loop 100,000 times, running the first loop is usually enough to catch the bugs.

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [December 27, 2022, 6:03am UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/35 "2022-12-27T06:03:44Z")

</div>

When you run code in SciPy (or Matlab or whatever; there is also Julia which is supposed to have certain advantages in terms of compilation), the script may run 100x more slowly than native code, but the actual library (e.g., LAPACK) will be written in Fortran (or C++ or whatever), so the solution has always been to let the optimized library do the work.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [December 27, 2022, 6:10am UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/36 "2022-12-27T06:10:02Z")

</div>

> [@CaveMike](#):
>
> You end up with a native app that uses scripting as the top layer.

I’m aware of that. Python is excellent as glue code. It’s possible that the projects I’ve done could be “rephrased” in Numpy or some such, using optimized C/C++ or even GPU code. Still–if I’m just trying to bang something out quickly, I can usually write it directly in code more quickly than I can figure out how to translate it to a matrix multiply or something, or search the documentation for the function that does what I need.

I wasn’t aware that TensorFlow could now compile Python directly into GPU code. I’m curious how well it works, though. GPU code in particular is very sensitive to things like load/store coherency, and serious work requires detailed knowledge of things like shared memory, atomics, etc. But maybe the automatic stuff is good enough for a usable speedup over CPU code.

---

<div class="post-metadata">

**Author:** ![thelurkinghorror](https://avatars.discourse-cdn.com/v4/letter/t/7c8e57/32.png) [@thelurkinghorror](https://boards.straightdope.com/u/thelurkinghorror)\
**Post date:** [December 27, 2022, 7:32am UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/37 "2022-12-27T07:32:51Z")

</div>

Yes: using “base” Python type code might be very slow. But if you use the power of Numpy, you can run things much faster, and this is without even thinking of anything as much as GPU use. Generally in Numpy, Matlab, R, probably Julia, you can probably write most code by never personally writing loops, exceptions being things like if you don’t know how many runs to repeat.

I just ran two quick Monte Carlo type simulations in base Python code and in Numpy type code: create a 1000 x 1000 array of random numbers, check timing of multiple attempts using %timeit

1000 repetitions, Python code:  
413 ms ± 3.47 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)  
1000 repetitions, Numpy code:  
3.9 ms ± 47.1 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

10,000 repetitions, Python code:  
42 s ± 87 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)  
10,000 repetitions, Numpy code:  
379 ms ± 1.69 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

So code runs about 100x faster if you do some very basic optimization

---

<div class="post-metadata">

**Author:** ![MrDibble](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mrdibble/32/114_2.png) [@MrDibble](https://boards.straightdope.com/u/MrDibble)\
**Post date:** [December 27, 2022, 12:45pm UTC](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913/38 "2022-12-27T12:45:31Z")

</div>

I’ve never worked on production Python that wasn’t compiled into .pyc for actual use.

[Previous page](https://boards.straightdope.com/t/why-python-over-any-other-high-level-language/976913.md?page=1)
