omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Share code for beginners like me the Python help function

    Pythonista
    beginners doc share help
    2
    3
    3933
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Phuket2
      Phuket2 last edited by

      I have just been playing around with Pythons help function. While obvious for many, not all of us. I made a stupid example below just to give the idea. But if in your classes and functions you use doc strings, can help you to get an overview of what you are writing. Sometimes I write classes with so many methods, because I chop and change. This simple Python function can help put things into perspective.
      I know it is not about Pythonista directly. But many learning Python and Pythonistia here.

      # coding: utf-8
      
      class SolveTheWorldsProblems(object):
      	'''
      	Description:
      		its not possible
      		
      	Args:
      		the meaning of life
      			
      	Returns:
      		-optimisim 
      		
      	Raises:
      		more questions that can be answered
      	'''
      	def __init__(self, meaning_of_life):
      		'''
      			the comment for the __init__ method
      		'''
      		self.meaning_of_life = meaning_of_life
      		
      	def result(self):
      		'''
      			the comment for the result method
      		'''
      	 	return ('optimism')
      	 	
      	
      
      if __name__ == '__main__':
      	stwp = SolveTheWorldsProblems(666)
      	print help(stwp)
      
      1 Reply Last reply Reply Quote 1
      • Webmaster4o
        Webmaster4o last edited by

        Didn't know about that. Interesting.

        1 Reply Last reply Reply Quote 0
        • Phuket2
          Phuket2 last edited by

          I forgot to mention the obvious, is what I normally associate help() with. That is help(class.method).

          @omz, I mention this but understand very low on the priority list, but 2 things I think would be nice in the editor.

          1. A toggle switch in the popup sheet of the file class/methods/functions to show hide the prototype. It is nice and clean just to see the method/func name, but sometimes would save time if could see the prototype also.

          2. Not as important. But when a user class selected and your quick help button is selected that you could provide the same information as help() does in the popup.

          Again, I understand these are not burning issues. But ultimately anything that can help coding on small screens a bonus.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors