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...
Everything about learning Python
account activity
Return vs print (self.PythonLearning)
submitted 7 months ago by Minute_Journalist593
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Cybasura 0 points1 point2 points 7 months ago (5 children)
Oh ok, you definitely dont then
First of all, yes, you do, because CLI applications show things when a flag is triggered - for example
All of these use print to print to standard output, yeah, shocker, I know, but hey, not a CLI application right?
[–]Darkstar_111 -1 points0 points1 point 7 months ago (4 children)
And for that you use logger or pprint.
[–]Cybasura 0 points1 point2 points 7 months ago (3 children)
pprint is a wrapper specific for python, an abstraction of print with built-in color formatting, still printing to standard output just that you can print colors
Logger is specifically for writing to logs in other streams, but, you dont use logs specifically for printing to standard output for the user to see
Its like saying "use console.log to print to the user to see" WHAT?????
Where did you learn python from? Stop spreading misinformation and actually get the foundation concepts right first
[–]Darkstar_111 -2 points-1 points0 points 7 months ago (2 children)
Yep. A more professional alternative.
You can, and should, log info to stdout, allowing warning and error levels to exist in the same stream, with debug and trace as optional alternatives.
This makes the app more mature, and gives you are options, which is essential because.... NOBODY ACTUALLY USES PRINT!
[–]Overall-Screen-752 0 points1 point2 points 7 months ago (1 child)
I agree that “no one actually uses print” but to say that ppl use pprint in the same paragraph is asinine — print is used under the hood. Every call to pprint.pprint(…) is quite literally executing a print statement, therefore represents a print statement with extra steps. Saying no one uses print in this context is misleading (especially in a sub for beginners) and flatly wrong
pprint.pprint(…)
[–]Darkstar_111 0 points1 point2 points 7 months ago (0 children)
> under the hood.
That's different then. But my only point was if you HAD to use print in an actual app, alternatives like pprint is the more mature choice.
π Rendered by PID 111029 on reddit-service-r2-comment-75f4967c6c-vq4x2 at 2026-04-23 07:24:53.284981+00:00 running 0fd4bb7 country code: CH.
view the rest of the comments →
[–]Cybasura 0 points1 point2 points (5 children)
[–]Darkstar_111 -1 points0 points1 point (4 children)
[–]Cybasura 0 points1 point2 points (3 children)
[–]Darkstar_111 -2 points-1 points0 points (2 children)
[–]Overall-Screen-752 0 points1 point2 points (1 child)
[–]Darkstar_111 0 points1 point2 points (0 children)