I’m new to Python and am reading a book that came out in 2009 and so uses Python 2.5 syntax. It does the following:
_fields_ = [
("cb", DWORD),
("lpReserved", LPTSTR),
...
]
To me it looks like a list of tuples, but at the same time it feels like a Map/Dictionary. Was this the older syntax?
It’s perfectly good, current syntax, and expresses a list of pairs (two-item tuples). If you need a dict (and have no problem with duplicate keys;-),
dict(_fields_)will make you one (much likesomedict.items()makes you a list of pairs from a dict —list(somedict.items())if you’re in Python 3 but insist on getting a list rather than just a view/iterator, btw;-).