How to hand-optimize code
import string, types
def dictser(dict, ListType=types.ListType, isinstance=isinstance):
L = []
group = dict.get("main")
if group:
for key in group.keys():
value = group[key]
if isinstance(value, ListType):
for item in value:
L.extend([" ", key, " = ", item, "\n"])
else:
L.extend([" ", key, " = ", value, "\n"])
...
return string.join(L, "")
Previous slide
Next slide
Back to first slide
View graphic version