Python Forum
Is using while True loop good?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is using while True loop good?
#2
It would constantly loop so whilst it doesn't seem like the code would use up much resource it doesn't seem sensible.
I'd at least add a time delay to loop every 5 minutes or something. time.sleep(300) will but 5 minutes between each check.

There are better ways to do this but i'm unsure as to what your overall goal is but sleep function should help.
Reply


Messages In This Thread
RE: Is using while True loop good? - by HarleyQuin - Jul-02-2020, 04:36 PM
RE: Is using while True loop good? - by HarleyQuin - Jul-03-2020, 09:49 AM
RE: Is using while True loop good? - by buran - Jul-03-2020, 10:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  While True loop help Nickd12 2 2,059 Oct-17-2020, 08:12 AM
Last Post: Nickd12
  Do break operators turn while loop conditions from True to False? Drone4four 5 3,102 Oct-24-2019, 07:11 PM
Last Post: newbieAuggie2019
  How to use while true/while loop on python christing 4 2,995 Oct-08-2019, 08:02 AM
Last Post: perfringo
  Returning True or False vs. True or None trevorkavanaugh 6 9,499 Apr-04-2019, 08:42 AM
Last Post: DeaD_EyE
  file.write stops while true loop from executing in python3 boonr 3 3,219 Mar-25-2019, 12:50 PM
Last Post: ichabod801
  How to make loop go back to the beginning if test evaluaes to True. FWendeburg 1 2,890 Feb-13-2019, 01:26 AM
Last Post: stullis
  Returning true or false in a for loop bbop1232012 3 8,320 Nov-22-2018, 04:44 PM
Last Post: bbop1232012
  Get True of false outside a loop morgandebray 2 2,531 Aug-09-2018, 12:39 PM
Last Post: morgandebray

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020