Skip to content

Magenaut

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

iterable-unpacking

What does the star and doublestar operator mean in a function call?

August 22, 2022 by Magenaut

What does the * operator mean in Python, such as in code like zip(*x) or f(**k)?

Categories Python, Q&A Tags argument-unpacking, iterable-unpacking, parameter-passing, python, syntax Leave a comment

How does swapping of members in tuples (a,b)=(b,a) work internally?

August 21, 2022 by Magenaut

In [55]: a = 5 In [56]: b = 6 In [57]: (a, b) = (b, a) In [58]: a Out[58]: 6 In [59]: b Out[59]: 5 How does this swapping of values of a and b work internally? Its definitely not using a temp variable. Answers: Thank you for visiting the Q&A section on … Read more

Categories Python, Q&A Tags iterable-unpacking, python, python-internals, tuples Leave a comment

How are tuples unpacked in for loops?

August 21, 2022 by Magenaut

I stumbled across the following code:

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

Unpacking, extended unpacking and nested extended unpacking

August 21, 2022 by Magenaut

Consider the following expressions. Note that some expressions are repeated to present the “context”.

Categories Python, Q&A Tags argument-unpacking, iterable-unpacking, python, python-3.x Leave a comment

Getting only element from a single-element list in Python?

August 17, 2022 by Magenaut

When a Python list is known to always contain a single item, is there a way to access it other than:

Categories Python, Q&A Tags iterable-unpacking, list, python, python-2.7, python-3.x Leave a comment

Meaning of using commas and underscores with Python assignment operator?

August 15, 2022 by Magenaut

Reading through Peter Norvig’s Solving Every Sudoku Puzzle essay, I’ve encountered a few Python idioms that I’ve never seen before.

Categories Python, Q&A Tags iterable-unpacking, python, syntax Leave a comment

Type hints when unpacking a tuple?

August 13, 2022 by Magenaut

Is it possible to use type hinting when unpacking a tuple? I want to do this, but it results in a SyntaxError:

Categories Python, Q&A Tags iterable-unpacking, python, python-3.x, python-typing, type-hinting Leave a comment

pandas apply function that returns multiple values to rows in pandas dataframe

August 12, 2022 by Magenaut

I have a dataframe with a timeindex and 3 columns containing the coordinates of a 3D vector:

Categories Python, Q&A Tags apply, dataframe, iterable-unpacking, pandas, python Leave a comment

How do I convert a tuple of tuples to a one-dimensional list using list comprehension?

August 12, 2022 by Magenaut

Python 2.6

Categories Python, Q&A Tags iterable-unpacking, list-comprehension, python, tuples Leave a comment
  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