-2

I use time.sleep for lots of reasons But how do I use a time.sleep on only 1 variable? Is there a:

import time
time.sleep(j(10)) # <- Focus Here

Without me knowing Do I have to use another command? Or is it not available on python at all?

rizerphe
  • 1,340
  • 1
  • 14
  • 24
  • 1
    I actually don't even understand what you want to do – user8408080 Jun 25 '20 at 23:13
  • What do you mean? You can use a function with `time.sleep()`, but you gave to make sure the function returns a number. – 10 Rep Jun 25 '20 at 23:16
  • @БогданОпир Actually, what the OP is saying is he wants to pause the adjusting of one variable, and keep adjusting another. That doesn't really work in python unless you use threads. – 10 Rep Jun 25 '20 at 23:18
  • @10Rep oh, he does... It does work a little since you can create a listener that detects the change once it happens, checks if the time has passed, and reverts it... But, at the end of a day, that is not in any way efficient to do with integers, since the user can create a local var with a local object. I guess that could be solved by writing some C. The question, although poorly craafted, is really interesting in its core. Found [this](https://stackoverflow.com/questions/3942825/freeze-in-python), might be interesting. Int is already hashable, which means immutable... – rizerphe Jun 26 '20 at 06:02

1 Answers1

2

time.sleep will have python pause for the amount of time that you say. It will pause the entire program, so using time.sleep won't work on one variable. I'm assuming you want to maybe stop working on one variable but continuing working with another? Since python goes line by line through your code you would just stop writing code that effects the variable. Then once you want to start working on it again you can start writing code that impacts it again.

eagleman21
  • 116
  • 3