WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit dbec228f authored by Carl Friedrich Bolz's avatar Carl Friedrich Bolz
Browse files

reduce the use of has_global

it always lead to two dict lookups instead of one
parent fb5eccfe
......@@ -478,11 +478,7 @@ class Universe(object):
def get_global(self, name):
# Return the global with the given name if it's in the dictionary of globals
if self.has_global(name):
return self._globals[name]
# Global not found
return None
return self._globals.get(name, None)
def set_global(self, name, value):
# Insert the given value into the dictionary of globals
......@@ -515,8 +511,9 @@ class Universe(object):
def load_class(self, name):
# Check if the requested class is already in the dictionary of globals
if self.has_global(name):
return self.get_global(name)
result = self.get_global(name)
if result is not None:
return result
# Load the class
result = self._load_class(name, None)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment