Closed mgedmin closed 10 years ago
Hm. I see people out there actually use the typestats() function. I'd hate to make a backwards-incompatible change and break their code.
How about this: typestats()
gets a new argument, shortnames=True
. Functions wrapping typestats()
, like show_growth
, get the same argument. Then perhaps in objgraph 2.0 I break backwards-compatibility by switching the default value to False.
Here's a list of all the APIs that should be able to distinguish foo.A
from bar.A
typestats(shortnames=False)
most_common_types(shortnames=False)
show_most_common_types(shortnames=False)
show_growth(shortnames=False)
count('foo.A')
-- should probably support both short names and full namesby_type('foo.A')
-- likewiseshow_refs(shortnames=False)
-- should be able to display them differentlyshow_backrefs(shortnames=False)
-- likewiseshow_chain(shortnames=False)
-- likewiseI'm thinking for count()
/by_type()
I could check if the argument contains a '.', can compare the fully-qualified typename; if it doesn't, I use the current logic of using type(o).__name__
.
I wonder if I can write a custom class with name that contains a dot. Oh well, evil people who do that can use by_type('module.Evil.Class')
.
I wonder if Python 3 __qualname__
is relevant here.
I'm pushing my WIP to the long-typenames branch.
I will probably rebase it interactively a few times before merging.
I merged the branch to master and deleted it.
Forwarded from LaunchPad #1183768: