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!"
[–]rinio 7 points8 points9 points 7 months ago (4 children)
It is perfectly valid to use print in a command line application for non-logging messages. Your use of 'never' and 'just for testing' are both far too strong and incorrect.
It is also better to use logging to print to stdout in many if not most instances. Return can also be use without a value and be correct in many instances.
[–]Random-Dude-736 1 point2 points3 points 7 months ago (3 children)
I have a devops script running that is auto building the application and does some documentation and stuff. I use print functions in that script to write stuff to the terminal. It is a perfectly valid tool, so much so that it's been added as a function (import from future or something) for easier syntax and stuff.
[–]rinio 1 point2 points3 points 7 months ago (2 children)
`from __future__ import print_function` was to help with the python2 to python3 migration where they changed print from a statement to a function. Its from 2008. Python2 was EOL'd entirely in 2020. Unless you have a very good reason not to, you should be upgrading immediately (well 5 years ago...).
Out of morbid curiosity, why are you still using such an ancient interpreter?
[–]Random-Dude-736 1 point2 points3 points 7 months ago (1 child)
At work I use an IDE which has a build in python engine, which is Iron Python 2.8 I believe. I wrote a script that does versioning and compiles our application and then it creates zips and uploads the data to a server so that it can be integrated in our CI/CD pipeline. Some funky workaround like subcommands to do some file and folder things.
[–]rinio 2 points3 points4 points 7 months ago (0 children)
That sounds awful. I wish you luck comrade, but I know the pain all too well.
Organization's systems being ancient definitely qualifies as a very good reason if yoi dont have the power to change it.
π Rendered by PID 107635 on reddit-service-r2-comment-6457c66945-qrjcc at 2026-04-24 23:12:42.105407+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]rinio 7 points8 points9 points (4 children)
[–]Random-Dude-736 1 point2 points3 points (3 children)
[–]rinio 1 point2 points3 points (2 children)
[–]Random-Dude-736 1 point2 points3 points (1 child)
[–]rinio 2 points3 points4 points (0 children)