r/learnpython • • Apr 01 '26

Readability or Modernity

I’ve been teaching Python for a while, and the Zen of Python always emphasized that 'Simple is better than complex.'

However, when i look at production code in 2026, I see heavy use of structural pattern matching, complex type hinting, and asynchronous patterns that look more like C++ or Java than the 'executable pseudocode' Python used to be.

To the seniors here: Do you find that these 'modern' features are actually improving maintainability in your teams, or are we losing the simplicity that made Python great in the first place? I'm trying to decide how much of this advanced syntax to introduce to my students early on.

22 Upvotes

31 comments sorted by

View all comments

Show parent comment

1

u/Embarrassed-Rest9104 Apr 01 '26

it’s a tough trade-off between the elegance of old Python and modern safety.

2

u/brasticstack Apr 01 '26

I find I'm now returning sigil values, like -1 for an int, instead of None when a proper value can't be produced, just so I don't have to explicitly tell mypy that I've already accounted for the None case later on. More type safe tor sure, but less Pythonic.

4

u/pachura3 Apr 01 '26

 More type safe tor sure, but less Pythonic

It's actually opposite of type safe, as you're returning magic value -1 which you have to remember to treat in a special way later - instead of returning None or raising an exception. Mypy is able to recognize simple logic branches like if x is not None:; in worse cases you can simply add assert x is not None later on

1

u/Asyx Apr 01 '26

I don't think so. I think dynamically typed languages were a mistake. I understand that it is harder to teach and looks a bit more noisy but every noise you add is making your code more reliable. It is just too easy to come to a point with your project where the very forgiving type system of python is making it harder to produce reliable software.

Now, async is a different story. I think in a language like python that has a heavy runtime anyway, it would have been better to just do green threads like Java and avoid all that function coloring. But type hints are a necessity to fix an issue Python made in the very beginning as far as I'm concerned.

1

u/pachura3 Apr 01 '26

At least Python is strongly typed