Try to display various information useful for debugging with python

Try to display the current class name

class HogeClass:

  def hoge(self):
    print(self.__class__.__name__)

if __name__ == '__main__':
  HogeClass().hoge()

Try to display the current function name

from inspect import currentframe
def hoge():
  print(currentframe().f_code.co_name)

if __name__ == '__main__':
    hoge()

Recommended Posts

Try to display various information useful for debugging with python
Try to display google map and geospatial information authority map with python
Try to operate Facebook with Python
Try logging in to qiita with Python
Memo to ask for KPI with python
How to display python Japanese with lolipop
[For beginners] Try web scraping with Python
[Cloudian # 1] Try to access object storage with AWS SDK for Python (boto3)
Try to solve the man-machine chart with Python
Try to draw a life curve with python
Try to make a "cryptanalysis" cipher with Python
Try to automatically generate Python documents with Sphinx
Try to calculate RPN in Python (for beginners)
Try to make a dihedral group with Python
Python script to get note information with REAPER
Try to detect fish with python + OpenCV2.4 (unfinished)
5 Reasons Processing is Useful for Those Who Want to Get Started with Python
Location information data display in Python --Try plotting with the map display library (folium)-
Try scraping with Python.
[Python] Super useful debugging
Try to solve the programming challenge book with python3
[First API] Try to get Qiita articles with Python
Try to make a command standby tool with python
Try to solve the internship assignment problem with Python
Try debugging Python on Raspberry Pi with Visual Studio.
Try to operate DB with Python and visualize with d3
Schema-driven development with Responder: Try to display Swagger UI
It's too troublesome to display Japanese with Vim's python3.
Information for controlling the motor with Python on RaspberryPi
For those who want to write Python with vim
[Python-pptx] Output PowerPoint font information to csv with python
Try to automate pdf format report creation with Python
Python> function> Docstrings> Description to display with help () / .__ doc__
Try to factorial with recursion
Connect to BigQuery with Python
I tried to make various "dummy data" with Python faker
I tried various methods to send Japanese mail with Python
Try to understand Python self
Debugging with pdb in Python
Try Python output with Haxe 3.2
Connect to Wikipedia with Python
[AWS] Try adding Python library to Layer with SAM + Lambda (Python)
Post to slack with Python 3
Useful when debugging with TouchDesigner
[Ev3dev] How to display bmp image on LCD with python
Experiment to make a self-catering PDF for Kindle with Python
Try various things with PhantomJS
[Ipdb] Web development beginners tried to summarize debugging with Python
Try to bring up a subwindow with PyQt5 and Python
Useful tricks related to list and for statements in Python
Try to automate the operation of network devices with Python
Manipulate various databases with Python
Introduction to Python for VBA users-Calling Python from Excel with xlwings-
Try running Python with Try Jupyter
Switch python to 2.7 with alternatives
Write to csv with Python
Try face recognition with Python
~ Tips for beginners to Python ③ ~
It's Halloween so I'll try to hide it with Python
Try to import to the database by manipulating ShapeFile of national land numerical information with Python
Try to decipher the garbled attachment file name with Python