DEV Community

OMG! Python can't do this! Or can?

Tetri Mesquita on December 13, 2019

I would love to know if there is anything the python language can't do. I mean, in many places on the web I can find developers with problems in c...
Collapse
 
emalp profile image
Emalp

There is nothing Python can't do in terms of normal day to day coding sessions. However, if you were to dive deep bare metal level then there's things Python can't do. Like writing a a very small memory footprint program for a very small IoT device, in which case C would be preferred. An easy example would be programming a sensortag.
For most cases, Python is the way to go! It is one of the most self-sufficient and beginner-friendly languages of the generation!

Collapse
 
philipstarkey profile image
Phil Starkey

There are actually cases where you can use a cut down version of Python on a microcontroller!

See: micropython.org

Collapse
 
emalp profile image
Emalp

Oh okay there we go, so Python can actually do everything! Even better!

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

Well, you probably can't solve the halting problem in Python (unless of course you can find a way to solve it that would work in other languages as well).

More generally, Python is Turing complete and can easily emulate most other models of computation, so you'd be hard pressed to find something that you truly can't do in Python if you're just looking at the language itself and not specific implementations.

The biggest limitations it has are:

  • You can't have truly immutable user-defined data types without native extensions. This is actually the case with most languages that allow actual user-defined types though.
  • With the exception of micropython, memory usage is honestly pretty bad for a scripting language (which is why micropython exists in the first place).
  • With the exception of the PyPy implementation, Python sucks at true concurrency. Threading is almost worthless unless you're I/O bound because of how Python itself maintains thread-safety of it's internals, and the overhead of running multiple Python processes very quickly gets out of hand (mostly due to memory usage and how long it takes for the interpreter to actually start up).
  • Package management is a bit problematic at times. A lot of other languages make it very easy to define and handle dependencies on external projects and even do things in a way that you have the dependencies properly localized to the project itself without needing any extra work (see for example how Node.js and Elixir projects handle this). Python, OTOH, kind of assumes everything is installed either globally on the system or 'globally' for the current user, so you need special handling to keep projects with conflicting dependencies from screwing with each other (which is why Python needs the concept of virtualevn, but many other languages do not).
Collapse
 
juancarlospaco profile image
Juan Carlos

I am not very sure what kind of answer you want,
but Python is not too good for multiple things, but is good for other multiple things too,
this sounds like an invitation to roast it tho.
🤔

Collapse
 
mateiadrielrafael profile image
Matei Adriel

The lack of multiline anonymous functions always disgusts me