Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

tuples

List vs tuple, when to use each?

August 19, 2022 by Magenaut

Tuples are faster than lists. If you’re defining a constant set of values and all you’re ever going to do with it is iterate through it, use a tuple instead of a list.

Categories Python, Q&A Tags list, python, tuples, types Leave a comment

Ignore python multiple return value

August 19, 2022 by Magenaut

Say I have a Python function that returns multiple values in a tuple:

Categories Python, Q&A Tags function, python, tuples Leave a comment

a mutable type inside an immutable container

August 18, 2022 by Magenaut

I’m a bit confused about modifying tuple members. The following doesn’t work:

Categories Python, Q&A Tags immutability, list, mutable, python, tuples Leave a comment

Subclassing tuple with multiple __init__ arguments

August 18, 2022 by Magenaut

The following code works:

Categories Python, Q&A Tags inheritance, python, subclass, tuples Leave a comment

How to unzip a list of tuples into individual lists?

August 18, 2022 by Magenaut

Possible Duplicate:
A Transpose/Unzip Function in Python

Categories Python, Q&A Tags list, list-comprehension, python, tuples Leave a comment

Two variables in Python have same id, but not lists or tuples

August 18, 2022 by Magenaut

Two variables in Python have the same id:

Categories Python, Q&A Tags identity, python, python-3.x, python-internals, tuples Leave a comment

How to sort a list with two keys but one in reverse order?

August 18, 2022 by Magenaut

I was wondering what would be a Pythonic way of sorting a list of tuples by two keys whereby sorting with one (and only one) key would be in a reverse order and sorting with the the other would be case insensitive.
More specifically, I have a list containing tuples like:

Categories Python, Q&A Tags key, python, sorting, tuples Leave a comment

How to change values in a tuple?

August 18, 2022 by Magenaut

I have a tuple called values which contains the following:

Categories Python, Q&A Tags python, tuples Leave a comment

When are parentheses required around a tuple?

August 18, 2022 by Magenaut

Is there a reference somewhere defining precisely when enclosing tuples with parentheses is or is not required?

Categories Python, Q&A Tags python, syntax, tuples Leave a comment

Unpacking a list / tuple of pairs into two lists / tuples

August 18, 2022 by Magenaut

Possible Duplicate:
A Transpose/Unzip Function in Python

Categories Python, Q&A Tags list, python, tuples Leave a comment
Older posts
Newer posts
← Previous Page1 Page2 Page3 Page4 … Page6 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress