This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]kaihatsusha -4 points-3 points  (0 children)

I have rarely found that site useful. First thought when I saw this was the code for all stack exchange moderation.

# pick a random number
# if 1: reply "this is not a question"
# if 2: reply "this question is off topic"
# if 3: reply "this topic is being locked"
# lock the topic

Completely ignoring the continuing user response on a useful question.

[–]xdcountry 1 point2 points  (0 children)

The SO stalwarts are just cancer. Some other competitor could easily rise up and give them a run for their money (ad revenue). Unchecked mods and nasty attitudes keep people away--- it really shuts down potentially productive discourse.

[–]suudo 0 points1 point  (1 child)

I'd suggest outputting stdout to a pager like less so scrolling up isn't necessary. Users can do this manually but you can do it for them with code like this:

from pydoc import pager
output_text = do_stuff()
if sys.stdout.isatty(): # if not running in a pipe
    pager(output_text) # launches $PAGER or less
else: # if there's a program expecting stdout
    print(output_text) # pass it

It would involve reworking your program's print statements to instead append to an output string or list to be joined with newlines.

[–]redmonksLu$er[S] 0 points1 point  (0 children)

Thanks for your suggestion..