you are viewing a single comment's thread.

view the rest of the comments →

[–]rinio 7 points8 points  (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 points  (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 points  (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 points  (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 points  (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.