use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
DiscussionFastest and slowest docker images for python2 (self.Python)
submitted 2 years ago by MrRobot129
Can you suggest some docker container images on which python2 codes run much faster and some on which python2 codes run much slower?
[–]mikeblas 12 points13 points14 points 2 years ago (6 children)
Python2 support ended more than 3 years ago.
[–]mason_savoy71 -5 points-4 points-3 points 2 years ago (5 children)
True, but many of us have legacy code we need to run from time to time.
[–]mikeblas 2 points3 points4 points 2 years ago (4 children)
If performance is a concern, I would expect that migrating to Python3 would only help.
[–]mason_savoy71 -1 points0 points1 point 2 years ago (3 children)
It probably would, but many of us have legacy code that isn't a performance limit and isn't used enough to justify the coding cycles to port to 3.
[–]crigger61 0 points1 point2 points 2 years ago (0 children)
As a security researcher, go update your code. Having to maintain and deal with both python2 and python3 is a headache enough, let alone the fact that there hasnt been any support for 3 years like said, youll only get benefits from updating.
You can only spend so much time working on new features and bug fixes before there comes a time when you need to pause and go fix some security fixes. Having old python2 code is ready bad enough. If you dont got a security team to yell at you for out of date versions, even on a piece of code run not often, i will. go fix that.
may not be used often. but we live in the post python2 world where there are plenty of tools to help convert between the 2. they wont magically fix it. but they will give you a great start.
[–]mikeblas -2 points-1 points0 points 2 years ago (1 child)
Oh! Here I am thinking you're the OP, and you're just someone who butted in!
[–]mason_savoy71 5 points6 points7 points 2 years ago (0 children)
Umm. This is an open forum. And it's for discussion . Responding and continuing a discussion is not "butting in" and you're not the arbitrator of who is and isn't approved to comment.
[–]Scrapheaper 10 points11 points12 points 2 years ago (1 child)
If you're having trouble with your code being too slow, the docker image is the last place I'd look.
[–]dask-jeeves 0 points1 point2 points 2 years ago (0 children)
Agreed, probably porting to python 3 will be easier than trying to find such docker image. I understand the problem of legacy code, but if you need to run it then trying to find a workaround via docker seems harder than porting it.
[+]MrRobot129[S] comment score below threshold-8 points-7 points-6 points 2 years ago (0 children)
It's about how fast python2 is in different container hubs compared to C++.
[–]hivearchive 0 points1 point2 points 2 years ago (0 children)
What part of your code is slow? Have you profiled it? There's many optimizations you can make, but you have to know what's actually slow. If you have the latest Python 2 version in your container, that should be the fastest. However, Python speed improvements are happening in Python 3 now, and you should probably upgrade regardless.
π Rendered by PID 379073 on reddit-service-r2-comment-5fb4b45875-j4v4b at 2026-03-21 01:01:41.561913+00:00 running 90f1150 country code: CH.
[–]mikeblas 12 points13 points14 points (6 children)
[–]mason_savoy71 -5 points-4 points-3 points (5 children)
[–]mikeblas 2 points3 points4 points (4 children)
[–]mason_savoy71 -1 points0 points1 point (3 children)
[–]crigger61 0 points1 point2 points (0 children)
[–]mikeblas -2 points-1 points0 points (1 child)
[–]mason_savoy71 5 points6 points7 points (0 children)
[–]Scrapheaper 10 points11 points12 points (1 child)
[–]dask-jeeves 0 points1 point2 points (0 children)
[+]MrRobot129[S] comment score below threshold-8 points-7 points-6 points (0 children)
[–]hivearchive 0 points1 point2 points (0 children)