简体   繁体   中英

How to get full path for any (including local) function in python?

f"{f.__module__}.{f.__name__}" doesn't work because function f can be local, eg inside another function. We need to add some kind of marked ( .<local>. ) in the path to specify that this function is local. But how to determine when we need to add this marker?

使用f.__qualname__而不是__name__

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM