sys.maxsize in Python Last Updated : 17 May, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report maxsize attribute of the sys module fetches the largest value a variable of data type Py_ssize_t can store. It is the Python platform's pointer that dictates the maximum size of lists and strings in Python. The size value returned by maxsize depends on the platform architecture: 32-bit: the value will be 2^31 - 1, i.e. 214748364764-bit: the value will be 2^63 - 1, i.e. 9223372036854775807sys.maxsizeSyntax: sys.maxsize Returns: maximum value of Py_ssize_t depending upon the architecture Example 1: Let us fetch the maximum Py_ssize_t value on a 64-bit system. Python # importing the module import sys # fetching the maximum value max_val = sys.maxsize print(max_val) Output: 9223372036854775807Example 2: Creating a list with the maximum size. Python # importing the module import sys # fetching the maximum value max_val = sys.maxsize # creating list with max size list = range(max_val) # displaying the length of the list print(len(list)) print("List successfully created") Output9223372036854775807 List successfully created Example 3: Trying to create a list with a size greater than the maximum size. Python # importing the module import sys # fetching the maximum value max_val = sys.maxsize try: # creating list with max size + 1 list = range(max_val + 1) # displaying the length of the list print(len(list)) print("List successfully created") except Exception as e: # displaying the exception print(e) print("List creation unsuccessful") OutputPython int too large to convert to C ssize_t List creation unsuccessful Comment More infoAdvertise with us Next Article sys.maxsize in Python Y Yash_R Follow Improve Article Tags : Python Python-sys Practice Tags : python Similar Reads sys.maxint in Python In Python 2, sys.maxint refers to the maximum value an integer can hold on a given platform. This value is:2³¹ - 1 = 2147483647 on a 32-bit system2â¶Â³ - 1 = 9223372036854775807 on a 64-bit systemsys.maxint was typically used as a very large number in algorithms requiring an upper bound, like finding 3 min read maxsize() method in Tkinter | Python This method is used to set the maximum size of the root window (maximum size a window can be expanded). User will still be able to shrink the size of the window to the minimum possible. Syntax : master.maxsize(height, width) Here, height and width are in pixels. Code #1: Python3 # importing only th 2 min read max() and min() in Python This article brings you a very interesting and lesser-known function of Python, namely max() and min(). Now when compared to their C++ counterpart, which only allows two arguments, that too strictly being float, int or char, these functions are not only limited to 2 elements, but can hold many eleme 3 min read Max Heap in Python A Max-Heap is a Data Structure with the following properties:It is a Complete Binary Tree.The value of the root node must be the largest among all its descendant nodes, and the same thing must be done for its left and right sub-tree also.How is Max Heap represented? A max Heap is a Complete Binary T 6 min read Python - max() function Python max() function returns the largest item in an iterable or the largest of two or more arguments. It has two forms. max() function with objectsmax() function with iterablePython max() function With ObjectsUnlike the max() function of C/C++, the max() function in Python can take any type of obje 4 min read Like