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
-
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)
-
Didn't know about that. Interesting.
-
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.
-
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.
-
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.
-