Skip to content

Commit

Permalink
add fixme about merge operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Abyss-W4tcher committed Jan 18, 2025
1 parent 0ee016e commit c2ef3c2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions volatility3/framework/symbols/intermed.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,12 @@ def enumerations(self) -> Iterable[Any]:
@property
def types(self) -> Iterable[str]:
"""Returns an iterable (KeysView) of the available symbol type names."""
# self.natives.types (set) is generally very small compared to user_types,
# so the dict conversion overhead can be neglected
# We use ** instead of
# `set(self._json_object.get("user_types", {}).keys()).union(self.natives.types)`
# because converting user_types dict to a set is costly.
# It is more efficient to convert the (very small) self.natives.types set to a dict.
# FIXME: On Python3.8 support drop, merge the two dicts using the merge operator:
# (self._json_object.get("user_types", {}) | dict.fromkeys(self.natives.types)).keys()
return {
**self._json_object.get("user_types", {}),
**dict.fromkeys(self.natives.types),
Expand Down

0 comments on commit c2ef3c2

Please sign in to comment.