How do I find out a name of class that created an instance of an object in Python if the function I am doing this from is the base class of which the class of the instance has been derived?

solution 1:

type(x).__name__ will give you the name of the class, which I think is what you want.

>>> import itertools
>>> x = itertools.count(0)
>>> type(x).__name__
'count'

solution 2:

x.__class__.__name__

1 comments
  1. jaenellpaepke March 4, 2022 at 12:10 AM  

    The Best Slots for Free at Dr. Green Casino - Dr.MCD
    Check out 동두천 출장마사지 our best 전라남도 출장마사지 slots for free at Dr. Green Casino. Have 안산 출장마사지 fun with these great casino 대전광역 출장안마 games, and become 김제 출장샵 a winner.

Popular Posts

无觅相关文章插件,迅速提升网站流量