> -----Original Message----- > From: qemu-devel-bounces+bcain=quicinc....@nongnu.org <qemu-devel- ... > AFAICT the keys for registers and new_registers can be derived from the values > themselves. Rather than worry about copy/paste errors causing these not to > correspond, you can create a dictionary from an iterable like so: > > registers = ( > GprDest("R", "d"), > GprDest("R", "e"), > GprSource("R", "s"), > GprSource("R", "t"), > ... > ) > registers = { reg.regtype + reg.regid for reg in registers }
Sorry, forgot the value - that would yield a set and not a dict. registers = { reg.regtype + reg.regid: reg for reg in registers }