Python | sys.setswitchinterval() method Read Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report This sys module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It provides information about constants, functions and methods of python interpreter. It can be used for manipulating Python runtime environment. sys.setswitchinterval() method is used to set the interpreter’s thread switch interval (in seconds). This floating-point value determines the ideal duration of the timeslices allocated to concurrently running Python threads. The actual value can be higher, especially if long-running internal functions or methods are used. Also, which thread becomes scheduled at the end of the interval is the operating system’s decision. The interpreter doesn’t have its own scheduler. This determines how often the interpreter checks for thread switches. Syntax: sys.setswitchinterval(interval) Parameter: interval: The new switch interval to be set. Return Value: It returns the interpreter’s thread switch interval. Example #1 : # Python program to explain sys.setswitchinterval() method # Importing sys module import sys # Using sys.getswitchinterval() method # to find the current switch interval interval = sys.getswitchinterval() # Print the current switch interval print('Before changing, switchinterval =', interval) # New interval interval = 1 # Using sys.setswitchinterval() method # to set the interpreter’s thread switch interval sys.setswitchinterval(interval) # Using sys.getswitchinterval() method # to find the current switch interval interval = sys.getswitchinterval() # Print the current switch interval print('After changing, switchinterval =', interval) Output: Before changing, switchinterval = 0.005 After changing, switchinterval = 1.0 Don't miss your chance to ride the wave of the data revolution! Every industry is scaling new heights by tapping into the power of data. Sharpen your skills, become a part of the hottest trend in the 21st century.Dive into the future of technology - explore the Complete Machine Learning and Data Science Program by GeeksforGeeks and stay ahead of the curve. Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore. Last Updated : 13 Aug, 2019 Like Article Save Article Previous Python | Calendar Module Next Python | sys.getswitchinterval() method Share your thoughts in the comments Add Your Comment Please Login to comment... Similar Reads Python | sys.getallocatedblocks() method Python | sys.getrecursionlimit() method Python | sys.getdefaultencoding() method Python | sys.setrecursionlimit() method Python | sys.getswitchinterval() method Python - sys.settrace() How to use sys.argv in Python Python - sys.stdout.flush() sys.maxint in Python sys.maxsize() in Python Complete Tutorials Python API Tutorial: Getting Started with APIs Advanced Python Tutorials Python Automation Tutorial OpenAI Python API - Complete Guide Pandas AI: The Generative AI Python Library Like R Rajnis09 Follow Article Tags : python-modules Python Practice Tags : python Additional Information Vote for difficulty : Easy Normal Medium Hard Expert