What would you want the most in Python 4?

twitter logo ・1 min read

Now that python 3 has hit 3.8 we can expect that python 4 will come out pretty soon.

Please put in the comment the most important single feature that you wish python 4 will have.

To start, for me it would be a stricter typing: typing is currently just a hint and not enforced in runtime. In a big project it helps a lot to have typing for everything (variables, functions).

Would be perfect if python can have a static typing mode that enforces this.

twitter logo DISCUSS (15)
markdown guide

Have a decent type and conversion validation.

Exception isn't control flow, and using it to check a variable's type compatibility is just dumb.

def isInt(val):
        return True
        return False

# How can python devs think this is ok?

I think the function here is rather canConvertToInt (or can_convert_to_int according to PEP8 πŸ˜…).
The int(val) works for both val=1 and val="1". If you want simply to test whether a variable is int, type(val)==int should be enough.


Python 3.8 gets a heck of a lot closer by putting the relevant typing module in the standard library, so you can leverage it much more easily. That being said... the biggest thing Python needs right now is architectural improvements in multiprocessing. So many things people do with Python benefit from multiple cores, and Python can't yet take full advantage of them.


In order to take advantage of multi core, it seems that Python developers often use native binding libraries like Cython and hardly take use of the multiprocessing package. For IO bound applications, asyncio is usually the solution.


To speed up Python, Cython can be a good option as we can mix C and Python code. We used to call 3D C++ functions from Python with Cython and the performance is on par with pure C++.


They are indeed similar. I think Cython users will tend to write custom C code whereas JNA is more about using existing code without modifying it but I might be wrong.


I think python 4 along with any other new version of a programming language should have multiple targets like kotlin and haxe have.


Have you had experiences where the GIL was the limiting factor on the runtime performance?

There are PEPs open now to help with this (including an overhauled subinterpreters implementation).

Classic DEV Post from Aug 4

You're not worth hiring unless...

Nguyen Kim Son profile image
SimpleLogin founder. Make login an enjoyable experience yet still protecting user privacy.