oter

Tuples can be used as immutable lists from "summary" of Fluent Python by Luciano Ramalho

Tuples can be used as immutable lists. Although a tuple is not as flexible as a list, it is faster, and its immutable nature can provide some advantages. A tuple is an immutable, fixed-size, and heterogeneous sequence, just like a list. One common tuple use is as a record with no field names. Since tuples are immutable, their elements are like records fields. For example, a query function can return a tuple with the query string and a tuple of parameters. Tuples support all the list methods that do not involve adding or removing items, such as slicing and indexing. The + operator can be used to concatenate tuples to form a new tuple. If a tuple holds references to objects, those references will not change, but the objects themselves can be modified if they are mutable. However, if the referenced item...
    Read More
    Continue reading the Microbook on the Oter App. You can also listen to the highlights by choosing micro or macro audio option on the app. Download now to keep learning!
    Similar Posts
    Relational theory informs relational database design
    Relational theory informs relational database design
    Relational theory, which underpins the relational model of data, is a powerful tool that can guide the process of designing a r...
    Understand file handling and streams
    Understand file handling and streams
    File handling and streams are essential concepts in C and C++ programming. They allow you to read from and write to files, whic...
    Take regular breaks to recharge
    Take regular breaks to recharge
    In the midst of a hectic workday, it can be easy to get caught up in the never-ending stream of tasks and responsibilities. How...
    Exploring geometry of shapes and figures
    Exploring geometry of shapes and figures
    Geometry is a branch of mathematics that deals with shapes, sizes, and properties of figures. It explores the relationships bet...
    Modules help organize code
    Modules help organize code
    When writing a large program, it's important to keep your code organized. One way to do this is by using modules. Modules are f...
    MRO is determined by the C3 linearization algorithm
    MRO is determined by the C3 linearization algorithm
    In Python, the Method Resolution Order (MRO) is the order in which base classes are searched when looking for a method in a cla...
    Searching algorithms locate elements within a data structure
    Searching algorithms locate elements within a data structure
    Searching algorithms are crucial tools for finding specific elements within a data structure. By employing various search techn...
    The C standard library provides essential functions for input/output
    The C standard library provides essential functions for input/output
    The C standard library includes a wide array of functions that are essential for input and output operations in a C program. Th...
    Python is used in automation and scripting tasks
    Python is used in automation and scripting tasks
    When you hear about Python being used in automation and scripting tasks, it's essentially referring to the fact that Python mak...
    “contextlib” simplifies context management with “with” statement
    “contextlib” simplifies context management with “with” statement
    The contextlib module provides utility functions for working with context managers and the with statement. One of the most comm...
    oter

    Fluent Python

    Luciano Ramalho

    Open in app
    Now you can listen to your microbooks on-the-go. Download the Oter App on your mobile device and continue making progress towards your goals, no matter where you are.