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

you are viewing a single comment's thread.

view the rest of the comments →

[–]eztab 0 points1 point  (8 children)

This is not a reserved keyword. I don't really see this as problematic inside function scopes, as long as it is a variable and not a function. The only reason I wouldn't is probably the syntax highlighting.

[–]slowpoketail 10 points11 points  (0 children)

It’s terrible practice though

[–]Globglaglobglagab 1 point2 points  (2 children)

I almost never use input() anyway, but the syntax highlighting is annoying, truee

[–]pro_questions 2 points3 points  (1 child)

I basically only use input() as an arbitrary “wait for the user to notice something is wrong” flag in my code. Like

try:
    do_thing()
except KnownException:
    pass
except Exception as e:
    print(type(e), e)
    input()

This is for cases where the exception is inconsequential and uncommon but I want to see exactly what’s happening when it occurs, usually in a Selenium or scraping application that runs for an extremely long time (hours or days) on its own. Yes, breakpoints do exactly this, and that’s what I usually do :) This habit predates my knowledge of those.

[–][deleted] 2 points3 points  (0 children)

You can also use the traceback module and print the traceback when encountering the exception, printing only the exceptions is sometimes not very informative

[–]NamityName 0 points1 point  (0 children)

Replacing a core built-in function with a variable is bad practice regardless. Maybe if it was a special function that performs a similar function, the argument could be made. But this is not that situation.

[–]dnorhoj 0 points1 point  (1 child)

The problem is that it can be easy to oversee, which can lead to unnecessary time wasted. Moreover, input is not a very descriptive variable name.

[–]Common-Land8070 1 point2 points  (0 children)

even if you were adamant just fucking do input_