[Python-Dev] UNPACK_LIST & UNPACK_TUPLE (original) (raw)
Barry A. Warsaw bwarsaw@beopen.com
Sat, 5 Aug 2000 19:52:05 -0400 (EDT)
- Previous message: [Python-Dev] UNPACK_LIST & UNPACK_TUPLE
- Next message: [Python-Dev] New SRE core dump (was: SRE 0.9.8 benchmarks)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"TW" == Thomas Wouters <thomas@xs4all.net> writes:
TW> I'm a tad confused about the 'UNPACK_LIST' and 'UNPACK_TUPLE'
TW> opcodes. There doesn't seem to be a difference between the
TW> two, yet the way they are compiled is slightly different (but
TW> not much.) I can list all the differences I can see, but I
TW> just don't understand them, and because of that I'm not sure
TW> how to handle them in augmented assignment. UNPACK_LIST just
TW> seems so redundant :)
TW> Wouldn't it make sense to remove the difference between the
TW> two, or better yet, remove UNPACK_LIST (and possibly rename
TW> UNPACK_TUPLE to UNPACK_SEQ ?) We already lost bytecode
TW> compability anyway!
This is a historical artifact. I don't remember what version it was, but at one point there was a difference between
a, b, c = gimme_a_tuple()
and
[a, b, c] = gimme_a_list()
That difference was removed, and support was added for any sequence unpacking. If changing the bytecode is okay, then there doesn't seem to be any reason to retain the differences.
-Barry
- Previous message: [Python-Dev] UNPACK_LIST & UNPACK_TUPLE
- Next message: [Python-Dev] New SRE core dump (was: SRE 0.9.8 benchmarks)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]