How to Use Pydoc: A Guide for Generating Python Documentation

Поделиться
HTML-код
  • Опубликовано: 4 ноя 2024

Комментарии • 11

  • @Pythonology
    @Pythonology  11 месяцев назад +1

    Dear friends!!! Please like the video and leave a comment. It helps with the visibility of my channel on RUclips. If you are interested in reading, you can always check out my latest articles on pythonology.eu Thanks a lot!

  • @jesprotech
    @jesprotech 11 месяцев назад

    This is great to know! Very interesting to learn about PyDoc and how we can automatically generate documentation! This could also in theory be used for github docs. I wonder if that could be an easy step. Then we could in theory host the generated static html code directly into it and keep the repo updated! I will try that. Thanks for the great video! 👍

    • @Pythonology
      @Pythonology  11 месяцев назад +1

      That sounds like a very good idea!

  • @irfanshaikh262
    @irfanshaikh262 11 месяцев назад

    Hi there once again.
    I will definitely use this module for my new chat sentiment analyser project.
    Thanks a tonn.
    I came looking for copper but instead I found gold.....

    • @Pythonology
      @Pythonology  11 месяцев назад

      Irfan thank you so much for your kind words and comment. Glad I helped 🙂

  • @NormannCfC
    @NormannCfC 11 месяцев назад +2

    I use a wrapper in my script to start several functions in a new thread using a decorator. When I tried out Pydoc, I found that the documentation only specified the wrapper's docstring for each of these functions. Unfortunately, the docstrings of the actual functions were ignored.
    def thread_it(func):
    """
    A wrapper to start functions in a new thread using a decorator.
    Parameters
    ----------
    func : function
    the function to start in a new thread
    """
    def func_wrapper():
    """
    func_wrapper starts the function "func" in a new thread.
    """
    _thread.start_new_thread(func, ())
    return func_wrapper
    @thread_it
    def weather_info() -> None:
    """
    Get weather informations using the *****-API
    """
    while True:
    try:
    ...
    The output from Pydoc:
    weather_info = func_wrapper()
    func_wrapper starts the function "func" in a new thread.

    • @Pythonology
      @Pythonology  11 месяцев назад +2

      OK, learned something about PyDoc today because of your question. Since inner/nested functions are not directly accessible from outside their enclosing function, PyDoc cannot generate documentation for them. However, if you want to generate documentation for the inner function, you can make it a standalone function or a method of a class.

    • @Pythonology
      @Pythonology  11 месяцев назад +2

      this could be a better reply :D

    • @NormannCfC
      @NormannCfC 11 месяцев назад +1

      @@Pythonology Ah OK thanks. So we both learned something. Cool too 🙂

  • @RaleignEli-h7l
    @RaleignEli-h7l Месяц назад

    Martin Shirley Perez Gary Williams Ronald

  • @vernonchristian3840
    @vernonchristian3840 10 месяцев назад

    🤭 'Promo sm'