if i've a program running on a server, which one will use more memory:
a = operation1()
b = operation2()
c = doOperation(a, b)
or directy:
a = doOperation(operation1(), operation2())
Edit:
1: i'm using CPython.
2: i'm asking this question because sometimes, i love readability in my code, so instead of writing looong sequences of operation, u just split them into variables.
Edit2:
here is the full code:
class Reset(BaseHandler):
@tornado.web.asynchronous
@tornado.gen.engine
def get(self, uri):
uri = self.request.uri
try:
debut = time.time()
tim = uri[7:]
print tim
cod = yield tornado.gen.Task(db.users.find_one, ({"reset.timr":tim})) # this is temporary variable
code = cod[0]["reset"][-1]["code"] # this one too
dat = simpleencode.decode(tim, code)
now = datetime.datetime.now() # this one too
temps = datetime.datetime.strptime(dat[:19], "%Y-%m-%d %H:%M:%S") # this one too
valid = now - temps # what if i put them all here
if valid.days < 2:
print time.time() - debut # here time.time() has not been set to another variable, used directly
self.render("reset.html")
else:
self.write("hohohohoo")
self.finish()
except (ValueError, TypeError, UnboundLocalError):
self.write("pirate")
self.finish()
as you can see there are variables that are only temporarly useful.