• General

    Tuple Unpacking

    Something few beginning Python programmers know about is tuple unpacking. This allows you to do fun stuff like returning multiple values from a function. Everyone knows how to create a tuple, right? [crayon-5bcc621e65e5b462796349/] Well using tuple unpacking, you can get all values from a tuple in one expression¬†and store them in their own variables. [crayon-5bcc621e65e5e576024546/] This allows you to do fun stuff like return multiple values from a function, by returning them as a tuple. After getting the return value from a function you simply unpack the tuple. [crayon-5bcc621e65e60813187114/] And unpacking the returned tuple in one simple expression: [crayon-5bcc621e65e61534105989/]