Friday, 15 March 2013

python 3.x - Get value or assign default -



python 3.x - Get value or assign default -

i'm optimizing scheme introducing lazy instantiation/loading. because i'm optimizing, tend utilize hoisting attributes reference within inner loops. however, lazy instantiation wind doing this:

tea = object.tea if not tea: tea = object.tea = moretea()

my query whether there more pythonic way above?

python-3.x

No comments:

Post a Comment