projects
/
mudpy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3664932
)
Eliminate exec() in Universe.new()
author
Jeremy Stanley
<fungi@yuggoth.org>
Tue, 24 Dec 2019 22:23:32 +0000
(22:23 +0000)
committer
Jeremy Stanley
<fungi@yuggoth.org>
Sat, 28 Dec 2019 20:40:11 +0000
(20:40 +0000)
Replace questionable exec call in the new() method of the Universe
class with cleaner getattr/setattr equivalents.
mudpy/misc.py
patch
|
blob
|
history
diff --git
a/mudpy/misc.py
b/mudpy/misc.py
index
eea2f00
..
fca279a
100644
(file)
--- a/
mudpy/misc.py
+++ b/
mudpy/misc.py
@@
-406,7
+406,7
@@
class Universe:
"""Create a new, empty Universe (the Big Bang)."""
new_universe = Universe()
for attribute in vars(self).keys():
-
exec("new_universe." + attribute + " = self." + attribute
)
+
setattr(new_universe, attribute, getattr(self, attribute)
)
new_universe.reload_flag = False
del self
return new_universe