簡體   English   中英

iPython%lprun on class中的函數

[英]iPython %lprun on function within class

我想知道如何在類結構中的python腳本上執行%lprun。

說我想看看在run()中花了這么長時間:

example.py

def outside_call():
    mc = MLIC()
    mc.run()

class MLIC(object):

    def __init__():
        pass
    def run():
       #Profile this function

通常如果run()不在類中,我會使用:

%lprun -f example.run example.run()

現在我需要......

%lprun -f example.MLIC.run() example.outside_call()

我該如何做到這一點?

我是個白痴。

在這種情況下,您實際上可以這樣做:

%lprun -f example.MLIC.run() example.outside_call()

我以為我嘗試了但打錯了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM