Unpacking, extended unpacking and nested extended unpacking

前端 未结 3 1309
轮回少年
轮回少年 2020-11-22 16:40

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

(this is a long list)

a, b = 1, 2               


        
3条回答
  •  粉色の甜心
    2020-11-22 17:32

    I you think your code may be misleading use other form to express it.

    It's like using extra brackets in expressions to avoid questions about operators precedence. I'ts always a good investment to make your code readable.

    I prefer to use unpacking only for simple tasks like swap.

提交回复
热议问题