Allow %memit to return a result object and to be quiet #116
Allow %memit to return a result object and to be quiet #116fabianp merged 3 commits intopythonprofilers:masterfrom
Conversation
| if not quiet: | ||
| if mem_usage: | ||
| max_mem = max(mem_usage) | ||
| print('peak memory: %.02f MiB, increment: %.02f MiB' % |
There was a problem hiding this comment.
This seems to duplicate _repr_pretty_ of MemitResult.
There was a problem hiding this comment.
Close, but not exactly, as the logic of _repr_pretty_ writes to a RepresentationPrinter supplied by IPython. I've refactored though so a __str__ can be obtained from MemitResult and revised the if-statement in memit.
|
Thanks for the patch. Could you take into account @superbobry's comments? Otherwise the code looks good to me. |
|
Merged. Thanks @wasade for the patch and @superbobry for the comments |
|
Great, thank you both!
|
An example of its use is below. The object and implementation were adapted from IPython's
timeitreturnable.