Steven D'Aprano wrote: > I would love to see your test code and profiling results that demonstrate > that explicit tuple unpacking in the body of a function is faster than > tuple unpacking (implicit or explicit) in the header of a function. Should be pretty close. I believe the byte-code is nearly identical: py> def f1((x, y)): ... pass ... py> def f2(x_y): ... x, y = x_y ... py> dis.dis(f1) 1 0 LOAD_FAST 0 (.0) 3 UNPACK_SEQUENCE 2 6 STORE_FAST 1 (x) 9 STORE_FAST 2 (y) 2 12 LOAD_CONST 0 (None) 15 RETURN_VALUE py> dis.dis(f2) 2 0 LOAD_FAST 0 (x_y) 3 UNPACK_SEQUENCE 2 6 STORE_FAST 2 (x) 9 STORE_FAST 1 (y) 12 LOAD_CONST 0 (None) 15 RETURN_VALUE STeVe
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4