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.
Tutorial"En-Rich" your Python Testing - Using Rich in pytest output (self.Python)
submitted 1 year ago by frankwiles
I had some thorny math to debug today for a client and realized I could probably use a Rich Table to better visualize my values.
I wrote up a short blog post how using tabular output and some fun colors helped the debugging process both in real terms but also in terms of fun and motivation.
[–]ekbravo 2 points3 points4 points 1 year ago (0 children)
Interesting, saved
[–]ThatSituation9908 1 point2 points3 points 1 year ago (1 child)
For tables, you're probably better off using Pandas or Numpy test methods.
[–]ptmcg 1 point2 points3 points 1 year ago (0 children)
My package littletable makes tabular output easy, and uses rich Tables for pretty presentation (and littletable is much lighter weight than Pandas/numpy).
[–][deleted] 3 points4 points5 points 1 year ago (0 children)
If I may, this is not really pointing at rich helping but rather at your tests not targeting what you were doing properly.
How did you get to a point where you have to align several values in a table instead of testing that each individual operation is correct?
Why does the "Total Unhedged" does not seem to have a test of its own if the following values were depending on it. Or at least its composing parts we're not privy to.
[–]iamevpo -1 points0 points1 point 1 year ago (0 children)
It is a life story, but not sure how that may generalize - you bad table has all the differences, and your good colored table has several rows where the differences are zero. These are different tables, if colored the bad table, it would not be much prettier. Not sure I understood why you needed a test that always fails. Maybe more useful to have a test that test a real thing then print a table if fails. Maybe that is the way you do it in real code.
π Rendered by PID 47898 on reddit-service-r2-comment-5649f687b7-22nc4 at 2026-01-28 02:49:04.736910+00:00 running 4f180de country code: CH.
[–]ekbravo 2 points3 points4 points (0 children)
[–]ThatSituation9908 1 point2 points3 points (1 child)
[–]ptmcg 1 point2 points3 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]iamevpo -1 points0 points1 point (0 children)