Skip to content

Instantly share code, notes, and snippets.

@RobertAKARobin
Last active March 27, 2024 23:55
Show Gist options
  • Save RobertAKARobin/a1cba47d62c009a378121398cc5477ea to your computer and use it in GitHub Desktop.
Save RobertAKARobin/a1cba47d62c009a378121398cc5477ea to your computer and use it in GitHub Desktop.
Python Is Not A Great Programming Language

Python is not a great programming language.

It's great for beginners. Then it turns into a mess.

What's good

  • A huge ecosystem of good third-party libraries.
  • Named arguments.
  • Multiple inheritance.

What should be good

  • It's easy to learn and read. However, it's only easy to learn and read at the start. Once you get past "Hello world" Python can get really ugly and counterintuitive.
  • The Pythonic philosophy that "There should be one -- and preferably only one -- obvious way to do it." As someone who loves working within rules and rigid frameworks, I love this philosophy! As someone who writes Python, I really wish Python actually stuck to this philosophy. See below.

What's "meh"

  • Forced indentation. Some love it because it enforces consistency and a degree of readability. Some hate it because they think it enforces the wrong consistency. To each their own.
  • Dynamic typing. There are lots of dynamically-typed languages and lots of statically-typed languages. Which kind of typing is better isn't a Python debate, it's a general programming debate.

What's bad

  • 400 ways (more or less) to interpolate strings. This prints "Hello Robin!" 3 times:

    user = {'name': "Robin"}
    print(f"Hello {user['name']}!")
    print("Hello {name}!".format(**user))
    print("Hello %(name)s!" % user)
    

    If there was a unique and obvious use-case for each of these then that would be one thing, but there's not.

  • 69 top-level functions that you have to just memorize. GvR's explanation sounds nice, but in reality it makes things confusing.

  • map doesn't return a list, even though the whole point of a mapping function is to create one list from another. Instead it returns a map object, which is pretty much useless since it's missing append, reverse, etc. So, you always have to wrap it in list(), or use a list comprehension, which, speaking of...

  • List comprehensions are held up as an excellent recent-ish addition to Python. People say they're readable. That's true for simple examples (e.g. [x**2 for x in range(10)]) but horribly untrue for slightly more complex examples (e.g. [[row[i] for row in matrix] for i in range(4)]). I chalk this up to...

  • Weird ordering in ternary/one-line expressions. Most languages follow a consistent order where first you declare conditions, then you do stuff based the on those conditions:

    if user.isSignedIn then user.greet else error
    
    for user in signedInUsers do user.greet
    

    Python does this in the opposite order:

    user.greet if user.isSignedIn else error
    
    [user.greet for user in signedInUsers]
    

    This is fine for simple examples. It's bad for more complex logic because you have to first find the middle of the expression before you can really understand what you're reading.

  • Syntax for tuples. If you write a single-item tuple (tuple,) but forget the trailing comma, it's no longer a tuple but an expression. This is a really easy mistake to make. Considering the only difference between tuples and lists is mutability, it would make much more sense to use the same syntax [syntax] as lists, which does not require a trailing comma, and add a freeze or immutable method. Speaking of...

  • There's no way to make dicts or complex objects immutable.

  • Regular expressions require a lot of boilerplate:

    re.compile(r"regex", re.I | re.M)
    

    Compared to JavaScript or Ruby:

    /regex/ig
    
  • The goofy string literal syntaxes: f'', u'', b'', r''.

  • The many "magic" __double-underscore__ attributes that you just have to memorize.

  • You can't reliably catch all errors and their messages in one statement. Instead you have to use something like sys.exc_info()[0]. You shouldn't have a catch-all in production of course, but in development it's very useful, so this unintuitive extra step is annoying.

What's bad about the culture

Most programmers will acknowledge criticisms of their favorite language. Instead, Pythonists will say, "You just don't understand Python."

Most programmers will say a piece of code is bad if it's inefficient or hard to read. Pythonists will say a piece of code is bad if "it isn't Pythonic enough." This is about as helpful as someone saying your taste in music is bad because "it isn't cultured enough."

Pythonists have a bit of a superiority complex.

@xennex22
Copy link

xennex22 commented Feb 5, 2022

Guido is an arrogant hack. He created a second rate scripting language which languished for a decade before by pure luck it was adopted by Google.

As an example, here is Guido's take on Python vs C++ (direct quotes):
"Python code is ... often 5-10 times shorter than equivalent C++ code"
and
"one Python programmer can finish in two months what two C++ programmers can't complete in a year"
and
Q: "Is C++ better than Python?" A: "If you have to ask, learn Python."

How arrogant do you have to be to claim with a straight face that a Python program is 5-10 times smaller than a C++ program? Or that programming productivity is 12 times high in Python than C++?

"An Empirical Comparison of Seven Programming Languages" finds that writing a program in a dynamic scripting language (Perl, Python, Rexx, Tcl) takes half as long as C/C++ and about half the length. The paper does not explain why the C and C++ programs were the same length and took the same time to write. The number of defects (ie quality) of each language was about the same. I would note that the example program was realitively small and involved string processing, something that favors dynamically typed scripting languages.

"A comparison of common programming languages used in bioinformatics" shows that Python was 90% the length of C++ and about 50% the length of C.

"On the Impact of Programming Languages on Code Quality" shows quality is about the same too.

So boom goes the dogma that Python programs are higher quality (one look at the source for most of the libraries would tell you that). And also we can reject the claims that Python programs are an order of magnitude smaller and an order of magnitude quicker to write.

@Preposterone
Copy link

Nice read, I have recently tried to delve into Python when learning algoritms and I was STUNNED by the fact that python doesn't have a simple one-line way to write an indexed for loop. Instead, every for is a for each with top-level range() or enumerate().
Baffling.

@grandslammer
Copy link

grandslammer commented Feb 10, 2022

I recently thought I'd give Python a try and was getting frustrated with several things about it, so I Googled and found this post. Here's what I really don't like about it, and these are really starting to put me off it entirely:

  • Multiple Python versions installed on my PC (forget about v2 vs v3, I'm talking about multiple versions of v3!)
  • Package management hell
  • Virtual environment hell
  • Whether to install vanilla Python (direct from the python.org website), or Anaconda - possibly both!
  • I'm beginning to get slight feelings of "this thing is trying to take over my PC!" (see points above)

Feels terrible from an organisational point of view.

With any other language I've used, if there's an update to the language, you just download it and it replaces the old version on your system. No messing around with multiple versions of the same language.
The same goes for updating packages - e.g. you just run "npm update" inside a project's folder for JavaScript, and boom! It's done.

Forgive me if there are easy fixes to the above, I'm still new to Python. I've looked and cannot find any resolutions anywhere though.

@ekeyser
Copy link

ekeyser commented Feb 10, 2022

That reminds me of the completely hilarious abandonment of pip search support....

xmlrpc.client.Fault: <Fault -32500: "RuntimeError: PyPI's XMLRPC API is currently disabled due to unmanageable load and will be deprecated in the near future. See https://status.python.org/ for more information.">

Yeah, like pip is the only thing on this planet that receives a lot of traffic. Embarrassing. "hundreds of thousands of search calls per hour". Awww, you poor little victim ;-)

ref
https://stackoverflow.com/questions/66375972/getting-error-with-pip-search-and-pip-install

@xennex22
Copy link

xennex22 commented Feb 14, 2022

  • The inability to retain backward compatibility between versions. Sure, languages like C++ evolve with standards, but I can take C source from 30 years ago written under C90 and it still compiles and works just fine under C++17. Backwards compatibility is a thing.
  • Assignment expressions. aka the walrus. To fix an original design mistake there now have to be two operators to do the same thing - assignment and expression assignment. No reason not have done it right in the first place.
  • Python only works in a narrow niche. Mobile, embedded, even desktop are not practical targets for Python. Why now? Because of the speed and memory requirements this language has.
  • Scoping was inefficient and when it got fixed it is now half broken. So you end up with things like a function being able to see variables from outside scope but not make changes to them. And Python is touted as the beginner language which is easy to understand. Not when there are gotchas like this.
  • Default arguments have a life and are mutable so become something other than the default value on subsequent calls. As above, why this non intuitive behavior?
  • Python makes a big deal about leaving out ++ and -- operators because they are 'not easy for beginners to understand' but includes +=
  • True and False are hacks for integer values
  • Lambdas are very restricted in that they have to be an expression and are limited to only one line. So you have to create a function and call that in your lambda expression, which more or less defeats the point of a lambda.
  • The development of a fix it culture around Python. eg Frustrated by incompatibility between Python versions for deployment? Use containers. Can't determine the logic flow if a program because of the invisible elements? Use an editor which shows tabs for you.
  • The hacks needed to cope with the 10000 faces of python versions. eg from __future__ import xxxxx. The only one I want to work does not work from __future__ import braces. And of course, it is not an import at all but uses the import keyword ie it is a hack. Also note the use of not one but two sets of double underscores.
  • The hacks needed to work with a dynamically typed language. eg how is / and // initiative to beginners? Also note that the introduction of the floating point division // broke old code. A cast is clearer because at least a beginner would have some idea what a float might be.
  • The 50 odd built in functions that break any object orientated structure to python. eg len(object) rather than object.len(). But then objects in Python are a cruel hack - looking at you self.
  • There is no forced structure to a python program. Thus people program all sorts of crazy things like mixing inline code along with code in functions. No wonder the quality of most libraries is low. Not everyone should write code that others depend on.
  • The prolific use of assert as a non debugging aid in release software. That would bring me on to the next problem with using Python in a commercial environment - the lack of a pre-processor.
  • Why is python written in C/C++ if C is so bad? You can implement a new language from any other by first writing an interpreter and using that to write a compiler. The interpreter is there, so why no compiler to compile the python written interpreter?
  • The more you look the clearer it is that python is an ugly hack of a language. The emperor has no clothes.

@isaax2
Copy link

isaax2 commented Feb 23, 2022

I'm happy that I'm not alone, I develop apps in since about 15 years in lots of languages and layers (C, C++, C#, Java, Objective-C, Swift, Javascript, LUA, Ruby ... etc). Now I took Python with an existing real project, and it's the first time that I can barely understand what's happening using the "simple and easy syntax".

@Odalrick
Copy link

map and enumerate do not have the same methods as list

Can someone explain to me exactly why completely different things should have the same methods?

And another thing:

single-item tuple (tuple,)

I know about the syntax for a single item tuple, and can even agree that it is an easy mistake to make; but for the lite of me I cant think of a single time when I'd actually need a single item tuple.

It's almost as if the thinks the only difference between tuples and list is that one is immutable; but no-one can be that silly can they?

Everyone knows tuples are fixed collections of heterogenous things and lists are variable homogenous collections.

@codingben
Copy link

@isaax2 Same here. I'm a developer with more than 10 years of coding - I never saw complicated language like Python, it's like a different world and very hard to keep it "simple" when your application become bigger and bigger (especially when it comes to PyTest, Typing, etc). Just see [1] how it's complicated.

I can confirm that Python is much much more complicated than Rust. 😄

[1] https://www.python.org/dev/peps/pep-0544

@Reenuay
Copy link

Reenuay commented Apr 9, 2022

Just learn functional statically typed language and you will understand that all those mainstream languages are the same sh*t. For example, you can learn Elm. After that I don't want ever write a project with a non-functional language.

@BrianG61UK
Copy link

BrianG61UK commented Apr 22, 2022

Dynamic Typing.
How can a language that doesn't identify type mismatches at compile time be considered anything other than a toy?
Mistakes in syntax can go unnoticed until they just happen to crash your program at some random point in it's life time.
It's almost as hopeless as the Microsoft Basic was on the first computer I owned as a teen back in the 80s.

@StitiFatah
Copy link

Dynamic Typing. How can a language that doesn't identify type mismatches at compile time be considered anything other than a toy. Mistakes in syntax can go unnoticed until they just happen to crash your program at some random point in it's life time. It's almost as hopeless as the Microsoft Basic was on the first computer I owned as a teen back in the 80s.

http://mypy-lang.org/

@tworthington
Copy link

tworthington commented May 8, 2022 via email

@BrianG61UK
Copy link

BrianG61UK commented May 9, 2022

I don't think I've had a runtime type mis-match error this century, and I mostly code in dynamically-typed languages. I suppose being able to check at compile time is perhaps a nice to have, where it can actually work, but if it's saving you from bugs routinely then you're doing something else wrong. Probably writing functions/blocks/methods which are too long so you lose track of what you're doing. Python has many flaws, but dynamic typing isn't one of them and adding it won't help.

You never have complicated global data structures and many people writing code that manipulates them?
When the data structures get modified to add new features, you never miss any of the changes needed in any module?

@nslay
Copy link

nslay commented Jun 23, 2022

I love how I can crash my Python scripts in ways you can programs written in native languages. Messages about segfaults and double-free corruption are things you wouldn't expect to see with Python. The worst I've seen to date is silent memory corruption... wow, I just never thought I'd see that in Python! Only knowledge about a native language can provide any clue as to why these kinds of crashes might have happened (and how to workaround or fix them in Python). A newbie computer user isn't going to understand, for example, numpy memory trickery and all the things that could go wrong if numpy doesn't account for shared memory correctly.

Maybe my gripes are more directed toward Python packages. Where do you draw the line between essential packages like numpy and Python, the language? I think numpy played a very big role in Python's popularity. Yet you can really shoot yourself in the foot in worse ways than described in this article. Like C levels of foot-shooting! And it's more mysterious because of how convenient and high-level the language is.

@rednnnno
Copy link

rednnnno commented Jul 1, 2022

The more I think about it, the more the forced spaced scopes remind me of the COBOL/RPG400 days...

I guess it's to be expected; we went from mainframes -> Personal computers -> cloud computing (really just back to mainframes - but on the internet now...)

So I guess it's just a fashion and it works exactly like fashion; concepts are cool for a few years; mostly forgotten about a pulled from the moth-balls back to relevance by some nostalgic geezers and/or some younguns that've never seen it before.

@masonova1
Copy link

masonova1 commented Jul 19, 2022

I want to leave this gem here:
Python equivalence to inline functions or macros (SO link)

Check the first answer, and witness the intersection of Python's optimization philosophy with Python's modularity philosophy.

It's somewhat old, but this sentiment with regard to performance problems still seems very present in the Python community. I'm convinced that this attitude will be the downfall of Python's industry prevalence, so long as none of the people at the round table can agree on how to improve this through language features instead of packages and modules.

Another problem I've noticed is that it is excruciating to convince Python developers in the first place that useful, ubiquitous concepts as simple as drop-in, expandable "macros" are deserving of optimized implementations, or even a language keyword or two. Every Pythonic solution I've heard to this, even when it's not just "don't worry about it", sounds astonishingly worse than just implementing the feature; As a programmer, I should be able to guarantee to at least my own interpreter that "yes, this static, unchanging macro with no state will be defined by the time you encounter something that needs it. If it hasn't, throw me some error about it."

With specific regard to the macros/inlining problem, I find arguments of the form "this is too complex to distinguish from regular functions for Joe Schmo the Python developer" to be implicitly patronizing to their own community and pretty unsatisfying as a justification for just not having anything like this.

Edit: I should add that the existence of the Inliner module is not even a solution to the specific problem as I stated it -- the Inliner does not "add macros/inlining to Python", it implements macros/inlining as a modular dependency. This is precisely the absurd collision of modularity philosophy and optimization philosophy that I hinted at earlier.

@ekeyser
Copy link

ekeyser commented Jul 26, 2022

That was entertaining and I can't wait for the python fanbois to be triggered. I agree indentation requirements are pure annoyance - basically forced training wheels. I'm not sure why any language forces indentation. Is it a sort of equivalent to logic/conditional/loops type-safety (or type-strictness)? That's my guess. "Oh, gotta make sure your if statements line up or you could do something bad!"

python2 and python3 are for all intents and purposes different languages. At least they differ enough and typically cannot be executed using the other interpreter without problems, errors, warnings that I just consider them to be completely different languages and yes a lot of this bleeds over into the packages and cross-python package incompatibilities. python3 should've been backward compatible with python2 - not sure why it wasn't. Feel like that was just yet another poor design decision.

Could the same be said for node/js and the different versions and standards there? I suspect so but w js you have what I believe is a standards body overseeing the publishing of the ECMAscript versions. And I believe (I could be wrong) you can run old js with new ECMAscript engines (or versions of node). With Python you just have an arbitrary decision by the language developers. And iirc there wasn't much of a deprecation or roadmap so what you ended up with was essentially 2 versions of every python app or one version or the other. I sort of have a hard time believing they couldn't maintain support for previous versions of the language.

Every language evolves over time but for some reason the Python way feels incredibly disjointed.

@fralligator
Copy link

fralligator commented Jul 30, 2022

dont use python
i only picked this shit language up because i need it for data science because physicists are fanboys of a shit language try coming from kotlin which is insanely fast, never get errors beautiful 20 years of learned errors corrected into the language from other languages then coming to python just to discover you never really know why you get an error it could be something utterly lame like simple spaces because of their utterly worthless scope decision O_o because they thought removing "{ }" or using ":" (omfg) would be a good idea they also use this utterly useless ____ case all the time with classes whereas camelcase utterly superior the type libraries is all messed up tbh fucking pain really hope kotlin destroys this worthless language or GO which is the next best alternative other than kotlin for data science

@openbakk
Copy link

Phyton is life!

@SanzSeraph
Copy link

Ruby is streets ahead of Python to my mind.

Don't you mean "rails ahead"?

@CLanguagePurist
Copy link

CLanguagePurist commented Aug 16, 2022

Going to toss my hat in the ring about what I have to say about Python.

Python is the most painful language that I have to deal with when working on Linux especially as an End User Perspective. There is absolutely no benefit to using Python from what I can observe in contrasts to literally every other programming language out there and I have worked across most programming languages, you name it, C/C++, Rust, DLang, Java, C#, Perl, Ruby, Javascript, Erlang, assembly, and more. Nothing stick out like a sore thumb like Python compared to all of them.

The most central problem with Python is ironically it's best aspect, the ecosystem itself. The problem is that the program that were shipped on Github, about 99% of the time, they fail outright, because they needed that one particular version of dependency to be made available, or that time progresses long enough that we end up having something like this:

        [ Program ]
               /\
             /    \
           /        \
       [A]        [B]
        /              \
      /                  \
   [C Ver 1]        [C Ver 2]

You have something like Dependency A and B relying on sub-dependency of different versions and they cannot use one newer/older than the other, they have no flexibility and demand THAT ONE PARTICULAR VERSION ONLY! Python folks obviously tried to fix it by "packaging" it into a virtual environment or using Conda, but all of those fail too no matter what. Sure, you could literally go in and try to fix them yourself, but another bug pop up and another and another and another, it just won't end.

Here the log I get from trying to simply run "pip install conda" on a fresh Linux install.

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-1wm2gmmv/conda_a01b278ecedc41b2a0fa3e7046717acf/setup.py", line 35, in <module>
          import conda._vendor.auxlib.packaging  # NOQA
        File "/tmp/pip-install-1wm2gmmv/conda_a01b278ecedc41b2a0fa3e7046717acf/conda/__init__.py", line 13, in <module>
          from .common.compat import iteritems, text_type
        File "/tmp/pip-install-1wm2gmmv/conda_a01b278ecedc41b2a0fa3e7046717acf/conda/common/compat.py", line 77, in <module>
          from collections import Iterable
      ImportError: cannot import name 'Iterable' from 'collections' (/usr/lib/python3.10/collections/__init__.py)

Does that look like a reliable ecosystem/software/programming language to you? No.

Granted, there were some fantastic programs like MesonBuild, but even Meson took an extra step avoiding the aforementioned problems, they don't use ANY dependency when building Meson software, they either implement it from scratch or copy the code over to their MesonBuild project. There is also another program in development that may potentially replace MesonBuild altogether in C++ anyway.

All in all, for the love of god, please DO NOT develop with Python, pick anything else, LITERALLY ANYTHING, BUT PYTHON!

@pglpm
Copy link

pglpm commented Aug 16, 2022

It should be called "Pythons", in the plural. And its "versions" should rather be called "forks".

@rilysh
Copy link

rilysh commented Sep 16, 2022

Even being an interpreted language, Python is really slow than any other interpreted languages right now we have. Some folks says "speed doesn't matter" yet you also bring frustrated about how slow your program is. It's a horrible idea to use Python for backend, especially a heavy load work, as the concurrency in Python literally suck.

And please, don't conflict with ML and data science where Python is being used. They used it because they wanted to complete a task as soon as possible, there's nothing about speed but all about how easily a concept can be understand by others, same goes to school/college where Python is being taught. I honestly don't think we shouldn't use it, but we should avoid using in critical apps or services where speed, stability and reliability is most important.

@ubaldot
Copy link

ubaldot commented Oct 22, 2022

Shall we also mention that Optional does not mean optional? :)

@ubaldot
Copy link

ubaldot commented Oct 22, 2022

In my opinion the main problem is that there is Python Zen and then there is Python

@tombohub
Copy link

single-item tuple (tuple,)

I know about the syntax for a single item tuple, and can even agree that it is an easy mistake to make; but for the lite of me I cant think of a single time when I'd actually need a single item tuple.

when you insert into database with parameterized query, library usually accepts data as tuple. When you want to insert only one value then you use single item tuple. Likewise, query execution returns tuple, and possibly single item tuple. It's better to use dictionaries in both cases, but many tutorials show tuples.

@nslay
Copy link

nslay commented Oct 24, 2022

Only use case for single item tuples I can think of is for initializing with repeated values.
For example:

zeros = (0,)*10 # Create a tuple of 10 zeros.

This kind of operator overloading is far far worse than anything you could claim of C++'s operator overloading on streams.

@edhemphill
Copy link

edhemphill commented Oct 26, 2022

It unfortunately started making its way into college curriculum... which is how it got so deeply embedded in the software industry. As scripting languages go - its honestly not bad. The main pain is the package management and byzantine library folders.

The core issue is WAY too many people use scripting languages when they should be using compiled languages. In my view scripts should only be used used when you might need to quickly change something or for single use actions, like installs / deployments, or building a ML model you will use somewhere else again and again. Not for constant operation. Like a website. Or an entire startup's code base. Seems the college professors which loved python forgot to explain this.

... the amount of compute in the world wasted to due to python's incredibly slow execution. Imagine. Lol.

@0xTheSmartGuy
Copy link

Even being an interpreted language, Python is really slow than any other interpreted languages right now we have. Some folks says "speed doesn't matter" yet you also bring frustrated about how slow your program is. It's a horrible idea to use Python for backend, especially a heavy load work, as the concurrency in Python literally suck.

And please, don't conflict with ML and data science where Python is being used. They used it because they wanted to complete a task as soon as possible, there's nothing about speed but all about how easily a concept can be understand by others, same goes to school/college where Python is being taught. I honestly don't think we shouldn't use it, but we should avoid using in critical apps or services where speed, stability and reliability is most important.

Very funny, Python might with some tricks go fast seriously. TIT-PL is the proof, go, it's not so bad, since i optimized it slightly

@nslay
Copy link

nslay commented Oct 28, 2022

Yes, interpreted languages are slower IF the routines being executed are actually written in the interpreted language. Most (if not all) of the ML and numerical algorithms used in Python wrap natively compiled code. As long as you're spending more time executing natively compiled code, the Python interpreter really shouldn't be causing too much of a slow down.

OK, so if the Python interpreter isn't really an issue when using natively compiled bindings (a lot of things!), what's the problem? Remember how Python is supposed to be about readability? Fast Python scripts (numerical ones anyway) are likely to be written in ways that are alien to how people think. Having to think in terms of linear algebra and vectorization to avoid the interpreter (e.g. to avoid otherwise more readable for loops that impose NO OVERHEAD in compiled languages) leads to potentially harder to read scripts. Sure, those scripts can execute at near native speeds but people will have difficulty understanding what's happening.

This isn't really a problem unique to Python. It's all scripting languages. MATLAB especially comes to mind!

@BrianG61UK
Copy link

It unfortunately started making its way into college curriculum... which is how it got so deeply embedded in the software industry. As scripting languages go - its honestly not bad. The main pain is the package management and byzantine library folders.

The core issue is WAY too many people use scripting languages when they should be using compiled languages. In my view scripts should only be used used when you might need to quickly change something or for single use actions, like installs / deployments, or building a ML model you will use somewhere else again and again. Not for constant operation. Like a website. Or an entire startup's code base. Seems the college professors which loved python forgot to explain this.

... the amount of compute in the world wasted to due to python's incredibly slow execution. Imagine. Lol.

Yes yes. 100% agree.

@xennex22
Copy link

xennex22 commented Nov 22, 2022

Micropython. The broken scripting language moves into the embedded world, added a host of problems to the already full basket of python failings.

  • Slow. Very slow. 300-500 times slower than C/C++. Start up time can be an issue too.
  • Debugging. Or complete lack of any debugging other than printing output.
  • RAM use.
  • Flash use. 'FLASH_TEXT' overflowed by xxx. Probably with micropython is biased towards processors with external flash like the ESP32 or RP2040.
  • Threading. Or lack of. It's not a RTOS.
  • Community. Same mantra repeated (it's faster to develop!) and same toxic responses (you're not using the right hack tool!)

And please don't tell me to write in python and then embed C, or use hack tool x to get around a shortcoming on python.
I blame the RP2040, which is just sad all by itself. And old ARM core. A lack of internal flash.
Micropython. The basic stamp of the 20s.

@DIYsciBorg
Copy link

DIYsciBorg commented Dec 5, 2022

Whatever circle-jerk this is:

===================================

C:\Program Files\KiCad\6.0\bin>python.exe -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in c:\program files\kicad\6.0\bin\lib\site-packages (22.2.2)
Collecting pip
Using cached pip-22.3.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
WARNING: The scripts pip.exe, pip3.10.exe, pip3.9.exe and pip3.exe are installed in 'C:\Users\e_pre\Documents\KiCad\6.0\3rdparty\Python39\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-22.3.1

[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\Program Files\KiCad\6.0\bin>python.exe -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in c:\program files\kicad\6.0\bin\lib\site-packages (22.2.2)
Collecting pip
Using cached pip-22.3.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
WARNING: The scripts pip.exe, pip3.10.exe, pip3.9.exe and pip3.exe are installed in 'C:\Users\e_pre\Documents\KiCad\6.0\3rdparty\Python39\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-22.3.1

[notice] A new release of pip available: 22.2.2 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\Program Files\KiCad\6.0\bin>

===================================

(Yes, I get that path warning AFTER adding that path to my path variable.. because.. REASONS!)

For a casual / occasional user (especially from a Windows env), grocking the process of maintaining dozens of custom environments is already a PITA, and seems like it SHOULDN'T be unnecessary. But the absolute useless error output and circle-jerking of trying to update even the most rudimentary installation is maximum frustration.

Not a single thing about Python is ready for "everyone" to use. Its only ever ready for "Steve" to use (or whomever is lucky enough to just happen to have their env set precisely the way Steve did).

How many "Apps built on python" have you watched break during the installation process. For me, its been 100%. NOTHING python ever works out of the box.

@nslay
Copy link

nslay commented Dec 5, 2022

Well that's what Docker (and similar) is for... a band-aid for Python dependency nightmares. I'm not trying to justify this, just that large Python projects point you to Docker for this reason. And, IMO, that is positively hideous. Is that really the future? Every application is a virtualized OS because of dependency hell? Horrifying...

@ccrsxx
Copy link

ccrsxx commented Dec 11, 2022

Lack of null safety is the biggest problem in Python IMO

@Username2k1
Copy link

Username2k1 commented Dec 12, 2022

yes Docker was created exactly because of the shittiness of Python. That is 100% true.

Sure docker isn't heavily used for countless of services that use other programing languages. Container are.just the base of modern architectures.

No other language sucks as bad as python it is why I refuse to
learn python and wish it would just die already.

So you don't know python but loose time here whining about it ? Interesting concept

And if colleges and code camps would stop teaching this horrendous, shitty
language and move to something better this problem would be solved much
more quickly.

Maybe the problem would be solved if you tried to learn it, seems like a troll anyway.

@greypanda
Copy link

And then he goes praising Ansible, which is written in Python.

@RobertAKARobin
Copy link
Author

Personal posts will be removed.

@TolstoyDotCom
Copy link

Consider the ternary operator in Java/PHP/etc vs how it's done in Python. Why didn't Python just copy the "normal" way? To be different? To avoid copying from other languages? To (like cults) force people to do things in strange ways particular to the cult to force them to leave their previous lives behind? While there might be some merit to putting one value at the start of the statement and the other at the end, putting the condition first seems to make more sense to more people.

Also, let's say you want to print out "the value is " + i . In Python you have to know that i is a string or convert it to a string.

Add in tacked-on OOP ("self" everywhere), lack of interfaces, using underscores as access control, and the worst feature of all, duck typing. If you have to turn a Car into a Duck, that's a design problem.

Would you do online banking at a bank that used Python for backend processing?

@Odalrick
Copy link

Odalrick commented Dec 23, 2022

Consider the ternary operator in Java/PHP/etc vs how it's done in Python. Why didn't Python just copy the "normal" way?

Because if you always copy everything, you never innovate. We'd be stuck with punch cards if no-one ever innovated.

Also, Python has an aversion to cryptic symbols, so they had to use text instead of "?" and ":" (Not necessarily cryptic code; I am aware that people have problems with comprehensions.)

If you start writing versions with words instead of symbols, I think you'll find that a if a > b else b falls out quite naturally. IIRC there were also some polls that found that the use for ternary operators was to set default values where it sort of makes sense to have the common result first.

My point is that there were good reasons to do it that way at the time, and they couldn't know before trying if it was a good idea.

let's say you want to print out "the value is " + i

First of all, you don't do it that way. Something like "the value is %s" % i would be more like it. (I know, cryptic symbols. But this has ancient roots, copied from C before the dawn of time. )

know that i is a string or convert it to a string

...yes. Obviously; that is what I want. I don't get that objection at all. If you want to print a string, you have to have a string to print. If you want to walk you have to have legs.

As an aside, using + for concatenation is one of the warts of Python. Addition is commutative, concatenation isn't. Silly.

I like self, makes things explicit. There are ABC:s and types now, don't need interfaces too. Underscores as access control is brilliant, a perfect solution to the actual problem.

Duck typing isn't about turning cars into ducks, it is about allowing both cars and geese to honk, without requiring them to be explicitly defined as honkers. You don't have to like duck typing, I don't particularly, but complaining about it because you don't know what it is... perfectly in line with this thread.

Would you do online banking at a bank that used Python for backend processing?

Yes... would you use a female doctor? It's not about the soft bits, all that matters is if it works correctly.

@Pharap
Copy link

Pharap commented Jan 2, 2023

the whole point of a mapping function is to create one list from another.

This is the one point I disagree on.

map, as a programming concept, should operate on an abstract sequence of objects. That includes things like trees.

To quote Wikipedia (from the same article this gist links to):

The concept of a map is not limited to lists: it works for sequential containers, tree-like containers, or even abstract containers such as futures and promises.

From a more practical standpoint: if map returned a mutable list that suggests that a new list has been created, so if you chained map together a few times you'd end up creating junk lists that would be automatically discarded.

If instead map creates some kind of lazy iterable object then you don't need to build a list until a new list is explicitly created from that iterable, which is a far more efficient way of doing things.

@Pharap
Copy link

Pharap commented Jan 2, 2023

@Odalrick:

Because if you always copy everything, you never innovate.

Python didn't innovate though. The trailing if idea already existed in Perl (which predates Python by just over 3 years), and it wasn't the best thought-out idea back then either.

Certain features become widely copied because they work well, and ternaries are one of those features.

(I know, cryptic symbols. But this has ancient roots, copied from C before the dawn of time. )

I can't help but find that a bit ironic after the mention of Python not liking 'cryptic symbols'. Especially considering the ternary operator is also from C.

If you start writing versions with words instead of symbols, I think you'll find that a if a > b else b falls out quite naturally.

It might read more like English, but personally I prefer Haskell's answer to the problem, which is c = if a > b then a else b. It follows the ternary ordering, it's easier to parse, and you can nest it: if a > b then (if a > 0 then a else 0) else (if b > 0 then b else 0).

(Haskell's answer to the problem actually comes from ML, which predates both Python and Perl. In fact, it's only 1 year younger than C.)

I like self, makes things explicit.

I definitely agree with this. I tend to prefer using an explicit this even in languages where it's optional.

Duck typing isn't about turning cars into ducks, it is about allowing both cars and geese to honk, without requiring them to be explicitly defined as honkers.

I'm not convinced that's actually a good thing.

Firstly, it's error prone.

honk is fine because you're not likely to find a honk method that does something other than making a sound, but there are situations where two classes might both have a method with the same name that does something very different.

For example, take +. As you said yourself, it's commutative for numbers but not for strings, so if you fed both into a function that expected the passed object to implement + in a commutative way then it could work fine for one but break silently for the other. That problem could be solved if there was some kind of interface concept that had to be opted into, which would separate the commutative adders from those objects that are using + for something that isn't really addition.

Secondly, not having an explicit interface means that instead of specifying a named concept and its rules within the language you end up either leaving that concept vauge and undefined, or having to define it in the comments. By writing a function that expects a passed object to honk, the concept of 'something that can honk' becomes important and relevant to your program, so callers should be aware of its existance and should be informed enough to know what honk is expected to do, and that's easier to manage when you have some kind of interface/typeclass concept.

I'm not necessarily saying Python should have something equivalent to interfaces, just that duck typing is error prone and better alternatives do exist.

@muratyaman
Copy link

muratyaman commented Jan 2, 2023

https://realpython.com/python-interface/

massive patchwork!

we can compare such features implemented by libraries like babel for javascript; they are loved by developers and eventually become the language features:

https://en.wikipedia.org/wiki/ECMAScript_version_history

a bit of supply and demand scenario there. (copying/inventing or not) some programming languages, which refuse to adapt or are too slow to adapt, will be eliminated eventually: check php world. people create new programming languages every year! probably more specialized and much more efficient in some aspects. we should try them.

if we are "data entry clerks" for "machines" using ways of "code", I'd rather enjoy that and be efficient at it too. I don't feel that way with some languages like python, perl, erlang, java, rust, c, etc. soon, we could be replaced by "machines" as well (check chat gpt!) but until then let's aim for delivering good quality, fast and efficient software applications. that also applies to language designers and compiler writers!

@Preposterone
Copy link

@Odalrick:

Underscores as access control is brilliant, a perfect solution to the actual problem.

What problem exactly do underscores solve and how?

@tankorsmash
Copy link

I enjoy the whitespace-is-significant aspect because of how code has to be at a certain minimum of readability. Still easy to make stuff unreadable but you can get some sort of feel for the code based on indentation.

I don't use black or another formatter for Python, but having an opinionated, language-wide formatter like elm-format makes life a lot easier when you're looking at foreign code.

I could imagine though, if you've only ever interacted with 'unpythonic' code, one would feel like it's an unrealistic or arbitrary goalpost and I could imagine feeling pretty frustrated there.

@Odalrick
Copy link

@Odalrick:

Underscores as access control is brilliant, a perfect solution to the actual problem.

What problem exactly do underscores solve and how?

The problem of telling the internal stuff that you shouldn't touch apart from the external API.

You're a the programmer, what does it matter how the private variables are protected? You're not going to access them regardless, right?

Reading private variables is a bad idea regardless of if you do it by decompiling a library and reading memory addresses or by accessing a variable named _count. In either case you know you are doing something you shouldn't, but it is your code and Guido can't stop you. So why bother trying.

@Preposterone
Copy link

@Odalrick:

Underscores as access control is brilliant, a perfect solution to the actual problem.

What problem exactly do underscores solve and how?

The problem of telling the internal stuff that you shouldn't touch apart from the external API.

You're a the programmer, what does it matter how the private variables are protected? You're not going to access them regardless, right?

Reading private variables is a bad idea regardless of if you do it by decompiling a library and reading memory addresses or by accessing a variable named _count. In either case you know you are doing something you shouldn't, but it is your code and Guido can't stop you. So why bother trying.

But... why not actually prevent access? What do underscores practically change? How is a naming convention BRILLIANT SOLUTION for private access?

Boggles my mind.

@Pharap
Copy link

Pharap commented Jan 15, 2023

why bother trying

Simple: to prevent programmers from doing something wrong, regardless of whether they're intending to do it.

Sure, someone who is determined might find a way to access a private variable anyway, but the point of having enforced private variables isn't to try to stop people who are determined to shoot themselves in the foot, it's to help programmers from making accidental mistakes - to help those who don't know that a variable is supposed to be private.

The underscore prefix 'solution' isn't really a solution, it's a convention, and conventions are only useful if everyone sticks to them.
Inevitably there will be people who flout convention. Even the core Python library itself contradicts the PEP 8 style guide at times.

@tombohub
Copy link

The underscore prefix 'solution' isn't really a solution, it's a convention, and conventions are only useful if everyone sticks to them.

yes, and I saw on Instagram guy posting code which breaks convention and his response: "I can type my code however I want".

Given that python is most popular among new programmers and there are instagram influencers who break conventions, those conventions are standing on glass legs

@Odalrick
Copy link

@Preposterone @Pharap @tombohub

But... why not actually prevent access?

Underscores do prevent access. Every time you see the name of the variable you see right there that you shouldn't use it. You literally cannot refer to it without including a note about not using it. How much more prevention is reasonable to provide?

someone who is determined might find a way to access a private variable anyway

Exactly. So you help programmers not to make accidental mistakes by ensuring that every time they see the name of the variable they are reminded that it shouldn't be used that way.

Instagram guy posting code which breaks convention

Bad programmers are bad programmers regardless of the language.

There is a certain nature of professionalism and responsibility assumed in Python. It is just one of the fundamental designs of Python, like white-space and "explicit is better than implicit". If that isn't something you agree with, then Python just isn't designed for you.

@grahamnicholls
Copy link

grahamnicholls commented Jan 16, 2023 via email

@Pharap
Copy link

Pharap commented Jan 16, 2023

Every time you see the name of the variable you see right there that you shouldn't use it.

That's like saying a "keep off the grass" sign prevents people from standing on the grass.

It's not really prevention if you're relying on people to self-censor and there's absolutely no obstacle standing in their way. Might as well leave your house and car doors unlocked while you're at it.

So you help programmers not to make accidental mistakes by ensuring that every time they see the name of the variable they are reminded that it shouldn't be used that way.

That doesn't help if they aren't aware of the convention in the first place.
If they aren't aware then there's nothing to stop them making the mistake.

In a compiled language with a proper 'privacy' mechanism the compiler would prevent the program from compiling and tell the programmer what they've done wrong. They'd either read the error and understand the problem or do further investigation and learn about the privacy mechanism, and then they'd fix their code.

In Python their code would run unimpeded with no warning about the mistake they'd just made, and then it would potentially break later down the line when they update their libraries and find that private variable is now missing because the implementation has been changed.

It need not even be an inexperienced programmer, it might just be a tired, overworked programmer who works on several language and forgot Python's convention because they work with so many different languages and it's hard to remember every language's little foibles. An enforcement mechanism would save them a headache.

Obviously Python isn't compiled in the conventional sense and its dynamic nature would mean any kind of actual enforcement would incur some runtime overhead, so I don't begrudge the fact they chose for forgo enforcement in favour of performance, but the point stands that a naming convention is not the 'perfect' solution.

Even if it were a 'perfect' solution, such conventions are not unique to Python.

Other languages have their own sets of conventions, but the problem is that there will always be groups who opt to break convention because they want to follow their own conventions, thus multiple different competing conventions appear.

Take C++ for example: one older convention is to prefix private member variables with m_, Google's style guide says to use an underscore suffix, some people use a preceding underscore like Python does, while other people (myself included) don't give private members a special naming convention at all and just rely entirely on the privacy mechanism.

If that isn't something you agree with, then Python just isn't designed for you.

<sarcasm>How very inclusive.</sarcasm>

@Odalrick
Copy link

@grahamnicholls

So you're not a professional if you despise Python, then?

No, you are a different nature of professional.

is it not implicit that _vars are not to be written to?

No, it is explicit. As explicit as the meaning of if, except and ==.

Implicit would be if, for instance, you could write private somewhere and then not have any warning that you cant use that variable until you run the code and get a runtime error

@Pharap

That's like saying a "keep off the grass" sign prevents people from standing om the grass.

Exactly. And if you are working with reasonable, well intentioned, trustworthy people, they will keep of the grass. Unless they really need to go on the grass; maybe if you have a heart attack they will go on the lawn to save you. You could surround your lawn with barb wire, land mines, and sharks. It won't stop anyone determined to go on the lawn, but it will prevent some uses you would approve of.

In Python the assumption is that the programmer is reasonable and trustworthy, and no particular things are put in to hinder them.

It is your code. Your lawn.

That doesn't help if they aren't aware of the convention in the first place.

There are a lot of things that doesn't help if you aren't aware of them. Programming is a skill.

Regarding enforcement; I like enforcement. I prefer compiled languages, and types, and automatic formatting, et al. But that isn't what Python is.

forgo enforcement in favour of performance

Exactly. It solves the actual problem with no downside. That is what makes the solution "perfect". And I never said Python was unique in this.

As an aside, not having one convention of how to write code is a flaw in the language. Good languages have one very strong style guide. Ideally it is a good style too, but I prefer restrictive to lax; even if I don't agree with most of the decisions.

If that isn't something you agree with, then Python just isn't designed for you.

<sarcasm>How very inclusive.</sarcasm>

The idea that everything should appeal to everyone is vile.

@muratyaman
Copy link

muratyaman commented Jan 16, 2023

there are many imperfect programming languages out there; none of them are promoting themselves as the best or the most dev-friendly in the world - not as much as python developers or university geeks. (except java maybe but that is a different story) please stop doing that. it is not funny anymore.

the fact that python is so strict e.g. about indentation is because they do NOT trust the developers and they enforce a programming style in the programming language itself! also, starting code blocks but missing the ending keywords or symbols are just horrible.

without the basic OOP principles, you cannot write a proper library or pieces of code in a large codebase - that will be used by other devs.

it is an ugly and inefficient non-dev-friendly language. they could not sell it to me. I will not use it and I will not promote it.

I'd rather promote a beautiful and inefficient language like Ruby!

or even I prefer using an ugly but very efficient language like Rust!

or maybe less uglier but efficient one: Golang!

so many choices are out there. use what you like and feel efficient with your team mates. (I'd still use one or more which are popular enough and maintained well.)

I can not pretend that my tools in my toolbox are the best, probably none of them is.(that is why people keep creating new programming languages every year!) I can deliver really impressive solutions using them and efficiently. I can have fun doing that - it's a bonus! with python I never felt I can do that.

@RobertAKARobin
Copy link
Author

use what you like and feel efficient with your team mates.

In my opinion this is always the correct approach.

@AkashicSeer
Copy link

AkashicSeer commented Jan 21, 2023

If nothing else this post shows how rabid the fanboys are. They make excuses for the suckiness of python, like christians make excuses for why the bible stories make no sense and contradict themselves, while painting god as a psycho tyrant.

You can't say anything without getting attacked. I personally hate python from trying to use programs written in the bullshit. It is such a pain to get anything written in python to actually run properly to the point it is often not worth trying for end users.

@nslay
Copy link

nslay commented Feb 9, 2023

Just encountered this gem! Ever do something like this in C++?

if (condition); {
  // This always executes
  // This is syntactically correct!
}

You have a similar shenanigan in Python with ','.

segtrans = LoadImage(image_only=True, ensure_channel_first=True), 
# segtrans is a tuple

So if you copy/paste something from a list (like a list of MONAI transforms), you get a tuple... and you will be scratching your head about being unable to, for example, __call__ a tuple.

IMO, Python should not be accepting a single comma as a declaration of a tuple. It should require the parentheses too! Lame...

@AkashicSeer
Copy link

AkashicSeer commented Feb 11, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 11, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 11, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 11, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 11, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 11, 2023 via email

@nslay
Copy link

nslay commented Feb 11, 2023

It does have a type annotation ability, but it doesn't seem mandatory. Maybe there's a strict mode that forces type correctness. It's nice for documentation purposes I suppose, but it has no actual effect on me when I use code with such type annotations.

@AkashicSeer
Copy link

AkashicSeer commented Feb 11, 2023 via email

@tombohub
Copy link

tombohub commented Feb 11, 2023

@AkashicSeer you talk a lot and saying very little, should join the senate

@AkashicSeer
Copy link

AkashicSeer commented Feb 12, 2023 via email

@nslay
Copy link

nslay commented Feb 14, 2023

AkashicSeer learning C++ huh? Python is definitely stupid in some ways and wastes a ton of my time when it breaks due to a syntax or type errors hours/days into execution... But boy are you in for treat for end-user and other-developer headaches. Nothing like symbol errors on Linux or missing redistributables on Windows. Compiles in Visual C++? Probably won't in GCC or Clang. You'll have the pleasure to deal with AutoConf, CMake (I like CMake!), pkg-config, reinvented build systems from Google et al. (like bazel, yuck!), etc... At least compilers will catch type errors and syntax errors before you spend days running the thing though...

That said, C++ is my favorite language and the one I'm most familiar with. It's a kraken of a language and the C++ standards committee is on track to ruin it with their overly frequent standards meetings. They just keep stuffing more and more features into C++ ... I think even Stroustrupp isn't completely happy about this. Even seasoned C++ veterans like myself can't keep up with all the junk they're adding every 2-3 years (I forget the frequency).

I think my next native language will be Rust. I've learned it once already and was impressed. But that borrowing system and lifetimes feature is really alien to me!

@AkashicSeer
Copy link

AkashicSeer commented Feb 15, 2023 via email

@movy
Copy link

movy commented Feb 15, 2023

Wow, thanks for this post. I was forced to use Python after a decade of coding in other languages, and it's mindblowing how backwards the snake is. Every single day I encounter another weird-thru-the-nose way of doing obvious things that would not even be mentioned as something notable in JS / TS for example. Just one SO discussion how to do ternary expressions in Python worth laughing at:
https://stackoverflow.com/questions/394809/does-python-have-a-ternary-conditional-operator

~512 mind-boggling answers for various versions of the language which numbers differ only by a single digit after period. "One pythonic way to do things" my a$$.

And this "pythonic" gem also, apparently it's idiomatic in Python (at least on some versions of it I guess):

logs = [log for log in logs if "message" in log]

Readable much?

Oh, and thing is SLOOW (well, it's in its name really, so joke is on us). And crashes with most cryptic irrelevant error messages I've seen since Windows BSOD errors.

Cannot wait for ML and sicentific crowd to get their stuff together and move on to something more sane and not 40 years old.

@AkashicSeer
Copy link

AkashicSeer commented Feb 16, 2023 via email

@Odalrick
Copy link

@AkashicSeer

They also don't understand why strong typing is a good thing.

Python has strong typing, it's static typing it lacks. They are working on it though.

And I fail to see how simply removing { and } magically makes a language
more readable?

It doesn't, obviously. Removing indentation, however, "magically" makes a language less readable.

However, what I'm really interested in is this fanatic hatred of significant white-space.

You say you use an IDE and reformat the code; so you must be using white-space all the time.

I just don't get it. Why would anyone care? What is so hard about using tab instead of "{" and backspace instead of "}"?

As far as I'm concerned, the white-space has to be there regardless of whether the language requires it or not, and most code agrees. So why not skip the indirection of "{}" and just use it?

Most objections I can at least understand even if I don't agree with them, but this one is just baffling. Especially that it is apparently a main objection, rather than a small one like "I don't like that ruby uses the keyword rescue instead of catch.".

@pglpm
Copy link

pglpm commented Feb 16, 2023

@Odalrick I don't "hate" the white space, but I disagree with you on the "has to be there". There are other ways to emphasize nesting and subclauses, for example with changes of colour, or of font, or some symbols on the left of line start. These other ways become more convenient for example if you have multiple nestings.

The point is that the end users should have freedom to choose what kind of syntax highlighting they prefer. Some IDEs for example highlight functions or variables or whatnot with different colours; that's useful. But what would you say if suddenly the syntax of the language required you to write function names in a particular colour?

@nslay
Copy link

nslay commented Feb 16, 2023

AkashicSeer, C++ user interface development won't be a breeze. If you want easy breezy UI development, it's pretty hard to beat something like PyQt I'm sad to say. It's not a fair comparison... Python and other scripting languages are for fast development, maybe not so much for optimal/correct programs. C++ is for optimal/correct programs... very slow development though.

@AkashicSeer
Copy link

AkashicSeer commented Feb 17, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 17, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 17, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 17, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 17, 2023 via email

@Odalrick
Copy link

@pglpm

emphasize nesting and subclauses, for example with changes of colour, or of font, or some symbols on the left of line start

Those all sounds terrible to me. You cant write font or colour to a text file, and random symbols are hard to write. You'd need an IDE, and perfect colour vision and ability to tell fonts apart.

It can be nice as an extra indication, but indentation rules. Can you give an example of a language that uses either of those to indicate nesting? That sounds like an esolang to me.

The point is that the end users should have freedom to choose what kind of syntax highlighting they prefer.

Here I completely disagree, although this is an opinion I have acquired in later years. First from prettier; but nowadays I consider a language incomplete if it doesn't have an opinionated and intrusive auto-formatter endorsed by the language. Another thing Python could be better at.

@AkashicSeer

With brackets you can let your IDE do all the formatting.

Same with indentation, you just press some other keys. Easier to press keys too, but that depends on the keyboard layout so not really an advantage.

All languages can and do have indentation.

Exactly. So where does the hatred for Python having indentation come from?

What arguments can anyone make against brackets? How do they magically make code not able to be indented and formatted and less readable?

How does indentation magically make code not able to be indented? I don't have a problem with brackets, I just don't understand why some people insist that they are the greatest thing ever and must be present in every language, on every row or they throw a tantrum.

line up bullshit with tabs and indentations is harder for people like myself who have visual impairments and dyslexia

Ok, so it's your disabilities that are the problem. I can understand that, it sucks. Still, it's like being upset at stairs because you need a wheel-chair. The anger seems excessive.

So you can paste one long, long ass line of code

And with python you never have to, because it will always be properly indented. Or broken, but your JavaScript or PHP can also be buggy.

@pglpm
Copy link

pglpm commented Feb 17, 2023

@Odalrick You say "Those all sounds terrible to me" – that's exactly my point: these matters are subjective, and therefore such choices should be left to the end user. Imagine a language that would force you to use different fonts for syntax; how would you feel about that? That's how people like me feel when forced to use spaces or tabs for syntax by Python.

Whitespace was never used for syntax in other languages as Python does now because it was too sensitive with copy, paste, and file transfer operations. Nowadays textual aspects such as fonts or colours can more and more be copied and pasted. So I imagine that in some years some smartass might have the brilliant (not) idea of forcing fonts or colours for syntax. That's what Python did with indentation.

You also say "I consider a language incomplete if it doesn't have an opinionated and intrusive auto-formatter...". Sure that's your opinion. I don't see why it should be imposed on others, and I won't let anyone impose it on me. Indeed that's why I don't use python anymore.

@AkashicSeer
Copy link

AkashicSeer commented Feb 17, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 17, 2023 via email

@Odalrick
Copy link

@pglpm

therefore such choices should be left to the end user.

And they are. Use a different language, that is the choice that should be left to the user.

It's not disliking meaningful indentation I have a problem with, I is the vitriol people seem to have about it I just don't understand.

It's like intentionally picking a red crayon out of a pack of different colours, and screaming about how you hate red.

Imagine a language that would force you to use different fonts for syntax; how would you feel about that?

I wouldn't use it. I also wouldn't hate and scream about it.

I don't see why it should be imposed on others

It should be imposed on others so that people write similar code that is easier to skim and create more useful diffs.

The same reason we have meaningful names and think about the structure of the code.

Indeed that's why I don't use python anymore.

Good, I don't want you to use tools you don't like or feel are not useful.

@Odalrick
Copy link

@AkashicSeer

So you're telling me that I can easily copy and paste python from one function to the next and simply let my IDE format it?

Maybe you can't. I've never had a problem with it. Different experiences give rise to different preferences.

Try PyCharm Community edition maybe? I even have it set up so I don't have to press a key, it formats when I save.

Why do pythonians love to stare at screens trying to figure out if the code is properly indented or not?

The point is you don't. The indention is there instantly, and you see instantly if the nesting is correct.

Could this be the issue? You don't use the indention to see if your code is correct?

Why do Pythonians love to waste so much time trying to visually format shit.

We don't. We set the nesting of functions, blocks, et cetera. It just "happens" that it also visually formats.

The thing you have to realise is that to other people the indentation is useful. To me and others who like indentation, it is the indention that tells us what the code is. The braces need to be there to satisfy the computer, but to us they're just line noise; the indentation tells us what the code does.

For instance, c:

if (a > 2)
    do_stuff();
    do_other_stuff();

Looks like both functions are in the if-block to me; and had it been Python I'd be correct and my code would work from the start if I wrote that. But in c, is is incorrect, and one has to reformat for it to be immediately visible.

Worse if you encounter this code in an example. It is obviously wrong, but there is no way of telling what it should do.

Python sidesteps that issue by saying that the for-humans structure is the same as the for-computer structure. Obviously code can still be buggy, but at least it isn't ambiguous and buggy.

What is wrong with letting the IDE do

Nothing. You still have to tell the IDE how to format. In C you do that with braces, in Python you do it with tab and backspace.

I'm sorry you have problems with Pronterface, maybe you can get a refund? And next time check out the software before you buy it, usually if it's that bad other people will warn you.

...so your apparent hatred of indentation is because you are unhappy with a piece of software you bought? So it's not really about the indentation?

disabilities are not a good reason

I get that it is unfair, but it not really Pythons fault that you have trouble reading. You don't have a right to demand that everything caters to you, no-one does. Everyone has things that are inaccessible to them. It's not like there is a shortage of other languages you can use instead.

@AkashicSeer
Copy link

AkashicSeer commented Feb 17, 2023 via email

@AkashicSeer
Copy link

AkashicSeer commented Feb 17, 2023 via email

@nslay
Copy link

nslay commented Feb 17, 2023

What have you tried with C++ when creating a UI? What didn't work? How can C++ development be any slower than using a shitty language that forces you to stare at a screen to make sure you indent properly? I'm looking at GTK, C++, Eclipse, Cmake. I'll never in my life touch Python, it sucks ass that bad. I'm mostly looking to create something that takes minimal space and works as fast as possible so even my old phones can run it. I want to be able to point my old phone at the printer and use it's camera and broadcast it via Wifi so I can view it on other computers and phones while being able to also control the printer.

For C++ GUIs, I have written a wxWidgets GUI for graphically designing power system survivability simulations. It's been a while, but wxWidgets is like Microsoft Foundation Classes, but cross platform. It uses lots of preprocessing macros! And more recently I've used Qt to design a plugin for MITK. I made a mesh editor plugin for fast 3D segmentation annotation for blob-like organs in medical images.

C++ GUI development is slower mostly because it involves having to compile every attempt. Every change you make requires compiling to test! And that's very slow for large projects. When you have a compilation error, you have to compile again after fixing the error! You also have to spend the time to setup the build system to pull in all the dependencies (include paths/library paths) to even build the thing in the first place! GUI toolkits like Qt are massive with hundreds of include files and dozens of libraries... you need to use something like CMake that can navigate the numerous includes/libraries of a GUI toolkit like Qt. On top of CMake, knowledge of library dependencies in Qt really helps!

For the end users, you have to do something like ship the Qt libraries and make sure those users have the proper dependencies or redistributables installed. Versions of dependencies is also an important consideration as different versions can break ABI! That's when you get dreaded symbol errors in Linux. Or you'll have to use something like Dependency Walker to figure out which symbols are missing on Windows.

Now in Python... you just import some Qt module and can instantly start making windows, buttons, text boxes, combo boxes, etc.... I had a colleague make a fancy network topology editor with PyQt in just a matter of hours! This time frame would be nearly impossible in C++! The key here is that you don't need build systems or compiling to make changes and test GUI changes or functionality. It just works out of the box with scripting languages like Python!

What do you get out of C++? Your program is probably going to run faster and it's likely more correct owing to all the compile-time type checks! What do you get out of Python, or other scripting languages? You'll be able to try things faster and with no project bootstrapping overhead.

@sammorton11
Copy link

This thread is great lol.

@grahamnicholls
Copy link

grahamnicholls commented Feb 17, 2023 via email

@AkashicSeer
Copy link

So every time you get an error on Python, it's at runtime - in a medical imaging app. As opposed to a c++ (not that I'm a fan) app, where it is at least syntactically and referentially correct. Scripting languages are not suited to critical apps IMO.

On Fri, 17 Feb 2023, 15:40 nslay, @.> wrote: @.* commented on this gist. ------------------------------ What have you tried with C++ when creating a UI? What didn't work? How can C++ development be any slower than using a shitty language that forces you to stare at a screen to make sure you indent properly? I'm looking at GTK, C++, Eclipse, Cmake. I'll never in my life touch Python, it sucks ass that bad. I'm mostly looking to create something that takes minimal space and works as fast as possible so even my old phones can run it. I want to be able to point my old phone at the printer and use it's camera and broadcast it via Wifi so I can view it on other computers and phones while being able to also control the printer. For C++ GUIs, I have written a wxWidgets GUI for graphically designing power system survivability simulations. It's been a while, but wxWidgets is like Microsoft Foundation Classes, but cross platform. It uses lots of preprocessing macros! And more recently I've used Qt to design a plugin for MITK. I made a mesh editor plugin for fast 3D segmentation annotation for blob-like organs in medical images. C++ GUI development is slower mostly because it involves having to compile every attempt. Every change you make requires compiling to test! And that's very slow for large projects. When you have a compilation error, you have to compile again after fixing the error! You also have to spend the time to setup the build system to pull in all the dependencies (include paths/library paths) to even build the thing in the first place! GUI toolkits like Qt are massive with hundreds of include files and dozens of libraries... you need to use something like CMake that can navigate the numerous includes/libraries of a GUI toolkit like Qt. On top of CMake, knowledge of library dependencies in Qt really helps! For the end users, you have to do something like ship the Qt libraries and make sure those users have the proper dependencies or redistributables installed. Versions of dependencies is also an important consideration as different versions can break ABI! That's when you get dreaded symbol errors in Linux. Or you'll have to use something like Dependency Walker to figure out which symbols are missing on Windows. Now in Python... you just import some Qt module and can instantly start making windows, buttons, text boxes, combo boxes, etc.... I had a colleague make a fancy network topology editor with PyQt in just a matter of hours! This time frame would be nearly impossible in C++! The key here is that you don't need build systems or compiling to make changes and test GUI changes or functionality. It just works out of the box with scripting languages like Python! What do you get out of C++? Your program is probably going to run faster and it's likely more correct owing to all the compile-time type checks! What do you get out of Python, or other scripting languages? You'll be able to try things faster and with no project bootstrapping overhead. — Reply to this email directly, view it on GitHub https://gist.github.com/a1cba47d62c009a378121398cc5477ea#gistcomment-4474454 or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYOKGHHTXUOLDI3PSSD3FLWX6LV5BFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA4TQOBUGA4DQNVHORZGSZ3HMVZKMY3SMVQXIZI . You are receiving this email because you commented on the thread. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

Python isn't suited for many things, but that is not stopping those who know only one language from trying to use the one language to do everything the one language shouldn't be used to do. I have yet to find a program written in Ptyhon that works properly without a ceremony of installing 10+ dependencies, and then it still doesn't work

@AkashicSeer
Copy link

What have you tried with C++ when creating a UI? What didn't work? How can C++ development be any slower than using a shitty language that forces you to stare at a screen to make sure you indent properly? I'm looking at GTK, C++, Eclipse, Cmake. I'll never in my life touch Python, it sucks ass that bad. I'm mostly looking to create something that takes minimal space and works as fast as possible so even my old phones can run it. I want to be able to point my old phone at the printer and use it's camera and broadcast it via Wifi so I can view it on other computers and phones while being able to also control the printer.

For C++ GUIs, I have written a wxWidgets GUI for graphically designing power system survivability simulations. It's been a while, but wxWidgets is like Microsoft Foundation Classes, but cross platform. It uses lots of preprocessing macros! And more recently I've used Qt to design a plugin for MITK. I made a mesh editor plugin for fast 3D segmentation annotation for blob-like organs in medical images.

C++ GUI development is slower mostly because it involves having to compile every attempt. Every change you make requires compiling to test! And that's very slow for large projects. When you have a compilation error, you have to compile again after fixing the error! You also have to spend the time to setup the build system to pull in all the dependencies (include paths/library paths) to even build the thing in the first place! GUI toolkits like Qt are massive with hundreds of include files and dozens of libraries... you need to use something like CMake that can navigate the numerous includes/libraries of a GUI toolkit like Qt. On top of CMake, knowledge of library dependencies in Qt really helps!

For the end users, you have to do something like ship the Qt libraries and make sure those users have the proper dependencies or redistributables installed. Versions of dependencies is also an important consideration as different versions can break ABI! That's when you get dreaded symbol errors in Linux. Or you'll have to use something like Dependency Walker to figure out which symbols are missing on Windows.

Now in Python... you just import some Qt module and can instantly start making windows, buttons, text boxes, combo boxes, etc.... I had a colleague make a fancy network topology editor with PyQt in just a matter of hours! This time frame would be nearly impossible in C++! The key here is that you don't need build systems or compiling to make changes and test GUI changes or functionality. It just works out of the box with scripting languages like Python!

What do you get out of C++? Your program is probably going to run faster and it's likely more correct owing to all the compile-time type checks! What do you get out of Python, or other scripting languages? You'll be able to try things faster and with no project bootstrapping overhead.

Wow thanks a lot for the detailed feedback. I have been reading and trying for days to decide how to create the UI. I am leaning towards putting it in a browser page, going to look into webview and web assembly today. One reason is I know all devices I want to target have a browser, phones, tablets, laptops, pcs etc. The issue is each has a different OS and each OS has it's own way of doing things. I have not found any UI framework that claims to work on all mobile devices. The other bonus to using a webview or browser etc. is I can use HTML,Javascript, CSS to build it and I can view it without compilation steps. The downside is it feels cheesier. LOL But my app needs a built in server for the user to remotely via browser to interact with their Printer/CNC machines anyways.

@AkashicSeer
Copy link

So every time you get an error on Python, it's at runtime - in a medical imaging app. As opposed to a c++ (not that I'm a fan) app, where it is at least syntactically and referentially correct. Scripting languages are not suited to critical apps IMO.

On Fri, 17 Feb 2023, 15:40 nslay, @.> wrote: @.* commented on this gist. ------------------------------ What have you tried with C++ when creating a UI? What didn't work? How can C++ development be any slower than using a shitty language that forces you to stare at a screen to make sure you indent properly? I'm looking at GTK, C++, Eclipse, Cmake. I'll never in my life touch Python, it sucks ass that bad. I'm mostly looking to create something that takes minimal space and works as fast as possible so even my old phones can run it. I want to be able to point my old phone at the printer and use it's camera and broadcast it via Wifi so I can view it on other computers and phones while being able to also control the printer. For C++ GUIs, I have written a wxWidgets GUI for graphically designing power system survivability simulations. It's been a while, but wxWidgets is like Microsoft Foundation Classes, but cross platform. It uses lots of preprocessing macros! And more recently I've used Qt to design a plugin for MITK. I made a mesh editor plugin for fast 3D segmentation annotation for blob-like organs in medical images. C++ GUI development is slower mostly because it involves having to compile every attempt. Every change you make requires compiling to test! And that's very slow for large projects. When you have a compilation error, you have to compile again after fixing the error! You also have to spend the time to setup the build system to pull in all the dependencies (include paths/library paths) to even build the thing in the first place! GUI toolkits like Qt are massive with hundreds of include files and dozens of libraries... you need to use something like CMake that can navigate the numerous includes/libraries of a GUI toolkit like Qt. On top of CMake, knowledge of library dependencies in Qt really helps! For the end users, you have to do something like ship the Qt libraries and make sure those users have the proper dependencies or redistributables installed. Versions of dependencies is also an important consideration as different versions can break ABI! That's when you get dreaded symbol errors in Linux. Or you'll have to use something like Dependency Walker to figure out which symbols are missing on Windows. Now in Python... you just import some Qt module and can instantly start making windows, buttons, text boxes, combo boxes, etc.... I had a colleague make a fancy network topology editor with PyQt in just a matter of hours! This time frame would be nearly impossible in C++! The key here is that you don't need build systems or compiling to make changes and test GUI changes or functionality. It just works out of the box with scripting languages like Python! What do you get out of C++? Your program is probably going to run faster and it's likely more correct owing to all the compile-time type checks! What do you get out of Python, or other scripting languages? You'll be able to try things faster and with no project bootstrapping overhead. — Reply to this email directly, view it on GitHub https://gist.github.com/a1cba47d62c009a378121398cc5477ea#gistcomment-4474454 or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYOKGHHTXUOLDI3PSSD3FLWX6LV5BFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA4TQOBUGA4DQNVHORZGSZ3HMVZKMY3SMVQXIZI . You are receiving this email because you commented on the thread. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

Actually with python you might not even get an error, shit just won't work properly and you will be left wondering WTF? Programs crash and don't tell you why etc. Python should not be used anywhere in medical fields.

@movy
Copy link

movy commented Feb 19, 2023

Python came to prominence when other alternatives were Perl, PHP or Ruby (or C++ hehe). It was a sane choice at the moment, but nowadays only a person who's whole coding experience consists of Scratch Jr, can pick Python as a starting point for their project. Which is a real bummer, as it truly feels like going backwards in time when you switch from literally anything modern to Python, and some of the brightest coders waste their (and ours, users') time on this mess.
I guess this thread includes people who used only Python and pray on Ven. Guido's portrait before bedtime and other people, who, you know, have experienced anything else in this world. It's a stupid idea trying to convince fanatics to walk away from their outdated beliefs, but it's fun to see them justifying their terrible life choices.

p.s. Community Service Announcement: JS/TS never required semicolons (apart from veeeeery rare edge cases, which can and should be rewritten anyway), and (IMHO) it looks way cleaner without them. So whoever brings up this point ("omg, ; at every line, yuck!") just displays his/hers level of (un)awareness about other languages.

@AkashicSeer
Copy link

AkashicSeer commented Feb 20, 2023 via email

@nslay
Copy link

nslay commented Feb 20, 2023

I do love C, but C has a lot of similar problems as C++. On top of that, a lot of the conveniences C++ offers, you have to roll yourself in C or use external libraries (e.g. C lacks STL). I didn't mean to scare you about C++ and I think you should prefer it over C. Not only do you get all of the powerful features of C++ and STL, it's mostly a superset of C and plays nicely with C!

If C/C++ are languages you are learning for practical reasons, I think C++ will land you more jobs than C. Otherwise, I'd just go straight to something like Rust... I know it's hyped a lot, but that one seems to have real potential. You get all the benefits and powers of C/C++ and some memory and thread safety C/C++ lacks. Heck, you can even write operating systems in Rust like RedoxOS! Although, memory safety in C++ is a lot better these days since you can generally use STL for all your data structure and memory management needs. You won't really be playing games with arrays and copies when STL is doing all of this for you under the covers.

@AkashicSeer
Copy link

I do love C, but C has a lot of similar problems as C++. On top of that, a lot of the conveniences C++ offers, you have to roll yourself in C or use external libraries (e.g. C lacks STL). I didn't mean to scare you about C++ and I think you should prefer it over C. Not only do you get all of the powerful features of C++ and STL, it's mostly a superset of C and plays nicely with C!

If C/C++ are languages you are learning for practical reasons, I think C++ will land you more jobs than C. Otherwise, I'd just go straight to something like Rust... I know it's hyped a lot, but that one seems to have real potential. You get all the benefits and powers of C/C++ and some memory and thread safety C/C++ lacks. Heck, you can even write operating systems in Rust like RedoxOS! Although, memory safety in C++ is a lot better these days since you can generally use STL for all your data structure and memory management needs. You won't really be playing games with arrays and copies when STL is doing all of this for you under the covers.

I'm working on software that interacts with 3d printers. I'll also be working on the firmware for the printer which is C++ So again I am not learning them for fun or for jobs, I am learning them to create software I need and will probably sell to others. I also do lots of microcontroller coding since I invent lots of things. So pretty much everything I am doing and will do will require C and C++. I'd like to know plain C because it leads into C++. I already know OOP so many of the C++ concepts should come pretty easily once I move to C++, actually I am learning both at the same time. One reason I want to know C is as you say, many libraries are in C and if I need to edit or create my own I need to know it.

Golang sounded very promising, but it just isn't. I don't want to deal with Golang and C while compiling or trying to cross compile. I'll check back with Golang in another 5 years to see if so many of the modules still need C.

@RobertAKARobin
Copy link
Author

RobertAKARobin commented Feb 20, 2023

Please move conversations unrelated to this article to a different platform. You might try r/cscareerquestions or r/experienceddevs, for example. Thanks!

@AkashicSeer
Copy link

Please move conversations unrelated to this article to a different platform. You might try r/cscareerquestions or r/experienceddevs, for example. Thanks!

Sorry I have severe ADHD and little things get me off on a wild tangent.

@valsteen
Copy link

List comprehensions are held up as an excellent recent-ish addition to Python

PEP 202 – List Comprehensions
https://peps.python.org/pep-0202/
Created: 13-Jul-2000

@djared999
Copy link

It's easy to learn and read.

There are two types of coding in Python, procedural code (wihout using classes or methods), which is so similar to BASIC it could be considered a version of BASIC (although an odd one without arrays), and object code, which is completely different in operation. Most textbooks barely mention the latter.

Dynamic typing.

It has both, variables are typed but objects are not. For instance :

a=1

  • is always a float unless specified in Python 3.

400 ways (more or less) to interpolate strings.

Who bothers formatting the teletype output anymore ? Is is still 1973 ?

There's no way to make dicts or complex objects immutable.
map doesn't return a list, even though the whole point of a mapping function is to create one list from another. Instead it returns a map object, [which is pretty much useless] since it's missing append, reverse,

Objects are always mutable. They must be because of the way object code works.
By mutable I mean they accumulate the output of an operation (method).

An object is assigned to a class and then a method is called. The output of the method is used by the class function, so it must always accumulate in the object.

Since append, reverse and other dot methods are object code, the object will alter, so you need to put the output into another object or variable.

Everything in Python is a reference, not the actual memory space itself : "The name of a thing is not the same as a thing".

If you want immutability, you use a variable. Confusingly, the interpreter will happily use a variable as an object and vice versa. So you have to be very clear about whether something is an object or a variable.

For instance, above -

b= a.double

  • will produce a single namespace with a value of 2, which has two names, a and b.

Python does this in the opposite order:

Only in object code, because of the way that objects are put into classes. If Then is used in procedural code.

@masonova1
Copy link

masonova1 commented Apr 6, 2023

Objects are always mutable. They must be because of the way object code works.
By mutable I mean they accumulate the output of an operation (method).

I fail to see how this is a good assumption of a programmer's intent in a lot of cases. For example, it practically means that I can't have a container that is indexable by non-integer types and is also immutable. Creating a properly "immutable dict" requires me to first construct a dictionary, and then use a MappingProxyType and make sure I have no references to the underlying dictionary, which is just a wholly inadequate solution IMO. There's a reason frozendict frequently makes the rounds in PEPs and forums well after it was rejected. Even in the rejection notice, it couldn't avoid saying "even though it might lead to performance benefits, we just think it's too hard":

The potential of optimizing code using frozendict in PyPy is unsure; a lot of other things would have to change first. The same holds for compile-time lookups in general.

PEP 416, https://peps.python.org/pep-0416/#rejection-notice

(I have issues with a couple other claims on the rejection as well, particularly the "secure sandboxing" complaint -- that's not a problem with frozendict, it's a problem with using frozendict to harden Python or package guts, which was just one of the use cases presented.)

@michellebowerhz4
Copy link

and I was just going to teach him, disappointment

@helmetwearer
Copy link

It's funny to watch someone whine about readability of expressions, and then also whine about features that force readability.

The author here is pushing their own opinions as facts, typical of someone with a superiority complex.

@ZehMatt
Copy link

ZehMatt commented Jun 22, 2023

It's funny to watch someone whine about readability of expressions, and then also whine about features that force readability.

The author here is pushing their own opinions as facts, typical of someone with a superiority complex.

Forced readability? Who are you kidding, its pretty subjective.

@helmetwearer
Copy link

It's funny to watch someone whine about readability of expressions, and then also whine about features that force readability.
The author here is pushing their own opinions as facts, typical of someone with a superiority complex.

Forced readability? Who are you kidding, its pretty subjective.

Everything covered here is subjective, hence the next line. Go back to programming games in not Python

@ZehMatt
Copy link

ZehMatt commented Jun 23, 2023

It's funny to watch someone whine about readability of expressions, and then also whine about features that force readability.
The author here is pushing their own opinions as facts, typical of someone with a superiority complex.

Forced readability? Who are you kidding, its pretty subjective.

Go back to programming games in not Python

What?

@openbakk
Copy link

openbakk commented Jul 1, 2023

great

@Draugr-official
Copy link

It's funny to watch someone whine about readability of expressions, and then also whine about features that force readability.

The author here is pushing their own opinions as facts, typical of someone with a superiority complex.

Unsure why you are on about ad hominem all of a sudden.
You are a grown man with the capability of staying formal when discussing topics, especially one that you favor.

I see you're not only throwing passive aggressive insults at the OP, but also at other commentors.
Typical of someone with insecurity issues.

@RaphGL
Copy link

RaphGL commented Sep 4, 2023

I found this thread and wanted to contribute to it. I've been using python for years now, it was my second language after javascript but since then I've used many more languages, probably over 10 at this point, so I've grown to dislike the language thought I still use it as the ecosystem and wide availability means that for some constrained use cases python is still the most optimal language.

I agree with a lot of what was said in the original gist and the subsequent comments, but to add more reasons to it, here are mine.

Why Python sucks

  • Has a bad type checking (mypy is not good enough), this should be obvious as type hinting was retrofitted into the language and mypy is not integrated into the language itself, being a sort of "official" not official type checker that sometimes won't even be able to properly type check a simple variable = get_value()

  • Lacks basic stuff like visibility modifiers, enums, constants, resulting in the abuse of the object system to get these features and through runtimes like pydantic and inheriting classes (Enum, Dataclass, etc)

  • Performance is pretty bad, to the point that "avoiding for loops" is considered an optimization in the language and people spend copious amounts of hours extracting stuff into C FFIs even in situations where it's unnecessary in other languages

  • Bad packaging standards (all the virtual environments and multiple standards for dependency management which all suck since pip itself is very basic, poetry kinda "fixes" it by wrapping the insanity but it's not part of any standards so you won't be able to shoehorn it into every project)

  • No good way to bundle things, there's Pyinstaller which has very cold starts, there's Wheel which is just another way to bundle stuff to be installed by pip so still too basic

  • Dunders are almost too powerful, they can have a lot of hidden stuff running behind your back. They also allow overloading a lot of behavior which can potentially be used in ways that would be hard to debug or figure out. Just look at all the dunders you can define on this table. You can even overload the await keyword...

  • All implementations of the language besides CPython are "incomplete", they do not work with the entire ecosystem the way you can with other languages with multiple implementations (say C, Go, C++, etc), one of the reasons for this is because of how much CPython relies on C to work and usually other implementations focus on compatibility with specific libraries

@jtint24
Copy link

jtint24 commented Oct 12, 2023

I'm not the biggest fan of Python but I think this is more of a miscellany of small issues than real serious problems with Python. Like sure, sometimes writing tuples with one element can be a little annoying but syntactically, there's no way to unambiguously distinguish single-element tuples from expressions in parentheses. Single-element tuples are pretty rare anyways. The double-underscore methods aren't the most elegant way to have operator-overloading like features but I don't think it's fair to say that you have to "memorize" all of them, nor all the builtin functions; if I happen to forget what memoryview does, I can just google it. The whole "you have to just memorize the top-level functions" bit sticks out to me particularly because 69 isn't a tremendously great number of top-level functions? Like PHP has 5,000. I'll add that never in my experience writing Python have I been hamstrung by forgetting what abs is for. Also, some of these just aren't correct: MappingProxyType functions as an immutable dict even if "frozendict" isn't in the language (though I do agree lack of serious mutability is an issue with the language).

But I agree with most of your points, my problem with this summary is just that basically every language has problems on that scale. Regexes are clunky? Some of the syntax is weird? Basically every programmer will say that (or something equivalently minor) about even their favorite language. I certainly don't think these are the issues holding Python back from being a "great" language. Frankly, they'd all be pretty easy to fix if the python team thought they were important enough to do so (and perhaps were willing to break some backwards compatibility). The outdated and messy packaging system, underdeveloped database tools, and lack of some more modern features (like multiline lambdas or more powerful Rust/Swift-esque enums) are bigger and harder-to-fix challenges for it.

@ifeelagood
Copy link

Learning to read list comprehensions and memorising dunder functions is the same as learning the nuances of any languages. one can argue that of any language.

you also have a complex

@KDean-Dolphin
Copy link

KDean-Dolphin commented Dec 18, 2023

I've been running across Python enough in my work that I thought it best to learn the language well enough to understand what I'm reading. As I always do when learning a new language, I took a recent (small) project and rewrote it in the new language as I went along.

For reference, I'm old enough that yelling "Get off my lawn!" is totally appropriate but not old enough that my belt buckle is hiked up to my belly button. I grew up on BASIC in various flavours as a teenager, then Turbo Pascal in first year university, followed by C, Fortran, APL (a language invented on 1970s-grade psychedelics if there ever was one), Prolog (1980s-grade psychedelics), and assembly. I was an early adopter of C++ and later Java. I've dabbled in various custom programming languages for databases, I know my way around VBA for Excel automation, I've developed applications solo for Fortune 500 companies that have measurably saved millions of dollars a year, and I've led teams developing applications for broad commercial use.

Oh. Dear. God.

No intrinsic support for constants. White space (indentation and line breaks) as mandatory syntax. Class instance attributes declared in constructors. Class static attributes declared outside constructors. Private names (methods, classes, attributes) managed by the underscore convention. Static class initializers through custom annotations. Typing declared as "x: int" for variables and "x() -> int" for methods. Required use of "self" because scope detection is too hard. Duck typing, so that a variable can end up as a type other than the type declared for it, leaving error detection to runtime. Wrapper types around everything so that even basic integer manipulation is tens to hundreds of times slower, and a numerical library (NumPy) that is mysteriously even slower when trying to do something with those same integers.

I understand the need for simple languages to do simple tasks (VBA is a case in point). And if that's all Python was confined to, I wouldn't be having to learn it unless I found myself in an environment where it was the only choice. But, if a language is going to be used for something mission-critical, it had better be good enough to protect me from myself. I will make mistakes; any programmer who tells you they don't (I've worked with a few) is just not good enough to recognize their own limitations and is not someone you want on your team. Many mistakes are easy and boil down to simple coding errors (highlighted by a good IDE before the code is even compiled) or misuse of a complex library (RTFM, assuming there is one). Logic errors are, of course, harder, and require comprehensive testing, and what I don't want is to go through logic testing and get sidetracked by a duck typing bug that a sane language would have caught at compile time with a syntax error or at assignment time with a typecast exception.

Python is what you get when someone looks at the landscape of languages and says to themselves, "You know what? We need a simpler language for simpler tasks." and watches in horror as the language gets adopted in ways for which it is totally unsuitable and never intended. And then, to address the problems that invariably come with languages that don't protect programmers from themselves, a whole community rises up to address the shortcomings and we end up with a language that is neither as simple as intended nor as fit for purpose as far more mature languages. It's the cripple and the tailor joke come to life.

Get off my lawn.

@dtonhofer
Copy link

dtonhofer commented Mar 27, 2024

Python is just a worse Perl. And you cannot even retcon use strict into it.

How much worse? I can't say (full disclosure: I like Perl - for some tasks. If code has been written in reasonable ways. With all warnings and strict, i.e. "must declare variable" and related gobbledygook, switched on. And files kept small and everything properly organized into modules.)

Plus the forced indent syntax makes it so that you cannot write one-liners in Stack Overflow comments. Hah! 😞

But at least it's well documented.

Apparently many people believe it's somehow "readable". But "readability" (for reasons of maintainability, or so it is said) should be a concern after "do you have proper static typing". Any-typed mutable stuff rather negates the effort. Plus the forced indentation seems to generate bad feature interactions with the rest of the language design.

Python for scripting the odd task, sure. But as someone on the Internet (rightly) said, it's very ill-advised, for economic or reliability issues, to try to build large software systems in Python.

And then can anyone rationally explain this:

my_list = ['foo', 'bar', 'baz']

def f():
    my_list = ['qux', 'quux'] # my_list is local to f()!
    my_list[0] = 'ggg'

f()

assert my_list[0] == 'foo'
assert my_list[1] == 'bar'
assert my_list[2] == 'baz'

def g():
    my_list[0] = 'texx' # this accesses the global my_list!

g()

assert my_list[0] == 'texx'
assert my_list[1] == 'bar'
assert my_list[2] == 'baz'

# But the interpreter / (bytecode compiler?) does not like this
# 
# def h():
#     my_list[0] = 'aloha'  # "cannot access local variable 'my_list'"
#     my_list = ['qux', 'quux']
#
# h()

def h():
    global my_list # now we can modify the global list
    my_list[0] = 'aloha'
    my_list = ['qux', 'quux']

h()

assert my_list[0] == 'qux'
assert my_list[1] == 'quux'

I just had to get this off my chest. Enough of this, I have an exercise in NumPy to do 😓 . And then it's over to Dart.

@dtonhofer
Copy link

@KDean-Dolphin

Prolog (1980s-grade psychedelics),

Hah! No, Prolog is absolute genius once you understand how it even works (i had to reset my assumptions).

If there were some serious investment in Logic Programming instead of everyone throwing money at trying to reinvent a square wheel with the whole JavaScript ecosystem (a practical joke, shurely?) one might see some progress in computer science. There are a lot of excellent ideas out there.

Meanwhile, I guess there is Mercury (underappreciated too, needs a proper IDE)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment