r/PythonLearning 5d ago

If you could remove one thing from Python, what would it be?

Every language has quirks. If you had the power to remove or redesign one feature, behavior, or common pattern in Python, what would you change and why?

14 Upvotes

48 comments sorted by

9

u/SaltCusp 4d ago

Indentation errors from mixing tabs and spaces.

3

u/WoodyTheWorker 4d ago

Which tab width should it assume then?

2

u/SaltCusp 4d ago edited 4d ago

Whichever one works for the whole file. Also 4.

1

u/WoodyTheWorker 3d ago

Do you want to start a holy war?

6

u/riklaunim 5d ago
from __future__ import braces

5

u/smoke-bubble 5d ago

Dynamic typing. The greatest shit of all times.

2

u/FoolsSeldom 4d ago

Why? Python is a strongly typed language, which I think is a great asset, but the dynamic approach is very convenient and modern editors and tools help address the problems that teams (especially) might encounter.

1

u/smoke-bubble 4d ago

Convenient for what? I've been working with python for several years and it has been convenient zero times so far. 

1

u/FoolsSeldom 4d ago

Well, I've found development teams citing speed savings in prototyping with reduced effort around declaration blocks, better fit for heterogeneous data, increased flexibility on behaviours in single code blocks applicable to different types. However, I can appreciate that this may not suit you.

I note you didn't respond to my initial query though.

1

u/HyperDanon 3d ago

You can solve most problems with proper automated tests. 

1

u/likethevegetable 3d ago

Why are you even using Python?

1

u/smoke-bubble 3d ago

Convenience. No braces, no semicolons Lots and lots of libraries that no other framework has. 

1

u/likethevegetable 3d ago

Dynamic typing can be pretty convenient 

1

u/smoke-bubble 3d ago

Still waiting for such a use case. You wanna be the first to name some? 

3

u/silvertank00 5d ago

it would be gettext's underscore reuse for me

3

u/denehoffman 4d ago

Careful, this is apparently a hot take

4

u/Cybyss 5d ago

Nothing. It's a great language at what it was designed to be - rapid prototyping, proof of concept, small quick "one off" scripts, things like that.

The problem with Python is the same as the problem with JavaScript - companies trying to build giant, robust, complex enterprise systems in a language not designed for that task.

3

u/smoke-bubble 5d ago

So what do we use instead?

4

u/Cybyss 5d ago

The obvious ones are Java and C#.

They were designed specifically for large-scale enterprise development. C# especially, its designers having learned from Java's mistakes.

C# has also been fully cross-platform for over a decade now. Both the C# compiler and the .NET framework are open source too.

3

u/smoke-bubble 5d ago

What if python has all the libs I need and C# like less than zero? Should I reinvent them instead of just use python?

We have wonderful enterprise systems running entirely on python that would be impossible in java or c# for example only because there are no pandas-like libs there. even such simple things as command-line parses are non-existent. in python you just take clikt and you're done. Java and C# are very limited in their abilities.

1

u/Distdistdist 4d ago

How do you like'em runtime errors?

1

u/smoke-bubble 4d ago

What kind of runtime errors do you mean?

1

u/Distdistdist 3d ago

Adhoc accidentally reassigning variables from one type to another and discovering error in some weird runtime moment vs at compile time

1

u/smoke-bubble 3d ago

Does not happen. I use type hints for everything and run mypy frequently. 

1

u/Cybyss 4d ago

Good point. Data science is the one area where enterprise languages could use some improvement.

Which is perhaps a bit ironic, considering how dominant working with SQL databases has been in these languages for decades. Relational tables aren't that different from Pandas dataframes.

1

u/smoke-bubble 4d ago

It's not exclusively useful for data science. I use it extensively just to manipulate Excel and csv files because they are crazy convenient XD

1

u/Mediocre-Pumpkin6522 4d ago

I played with it a couple of years ago and don't know if Microsoft followed through or lost interest but ML.NET was sort of equivalent to scikit-learn and there was a tie-in to TensorFlow.

1

u/Own_Attention_3392 4d ago

I've never been a fan of python supporting classes but having accessibility of class member be by convention. It's gross. Give me enforced accessibility modifiers please.

1

u/Gnaxe 4d ago

Probably asyncio. It's bifurcated the ecosystem while still not supporting multiple CPU cores. We already had Stackless which was less of a problem. That should've been adopted instead.

I almost said, "Get rid of classes", but I don't think I'd take it that far. Rather, it's the Java culture of using classes by default for everything and nailed down with static typing that I object to. This invariably results in a hairball.

1

u/AdmiralKong 4d ago

Dynamic typing is the best answer but since it's already been said, I'll go with significant whitespace. 15 years later I still hate it and basically no other language has picked it up. Its a loser of a design feature for sure.

1

u/ComprehensiveJury509 4d ago

I'm pretty happy with Python overall, but:

  1. type hints should have been introduced in its current implementation from the beginning, i.e. things like `list[int] | dict[str, int] | None` being possible over `typing.Optional[typing.Union[typing.List[int], typing.Dict[str, int]]]` should have been introduced from the beginning. It was an obvious no-brainer that this was preferred way to go about it. Now there's this mildly annoying co-existence of both ways to do it for no good reason.

  2. fully standardized docstrings. It would be amazing if there really was only one proper way to format your docstrings that can be easily checked by linters and missing/out-dated entries be detected by static type checkers. And especially, without the syntactical abomination that re-structured text is. The current state of docstrings is a mess and I absolutely hate maintaining them.

1

u/voidiciant 4d ago

+1 for docstrings
I‘m a beginner/intermediate in python and thought it was me being dumb, not understanding how to write a „correct“ docstring

1

u/Traveling-Techie 4d ago

Version incompatibilities.

1

u/code_tutor 4d ago edited 4d ago

indentation

Also how everything is slow af objects. Type hints are lacking. Most other things are fine.

1

u/origin-17 4d ago

Optional typing, I would prefer a strict mode for runtime.

1

u/voidiciant 4d ago

not having private/protected members

1

u/jerrygreenest1 4d ago

Python interpreter 

1

u/Pupation 4d ago

The “self” first parameter. It should just work like “this” in java without having to be declared.

1

u/FoolsSeldom 4d ago

I wish there was full, tier 1, support for mobile development and platforms. Currently, IoS/Android are second class citizens.

1

u/HyperDanon 3d ago

The self argument. Its a cool idea to exolicitly name it, and I'd like to use it, but if you name it anything other than self, then everyone will scream at you So effectively its always self anyways, So whats the point?

  • Either remove that from language and implicitly name it self
  • or let community be comfortable with using this feature and naming it whatever you want 

1

u/Spiritual-Big7900 3d ago

As a hare, probably their venom

1

u/CIS_Professor 4d ago

Well not remove, but change:

Ternaries:

This seems so awkward:

x = 5 if y == 3 else 4

compared to this:

x = (y == 3) ? 5 : 4;

2

u/MountainSalamander33 3d ago

The first one is like reading a text. The second I can't even understand it..

1

u/likethevegetable 3d ago edited 3d ago

Brutal take. Python is meant to read like English, not C.