Python Poetry: the __main__ Stanza
here's a snippet of Python doc:
This module represents the (otherwise anonymous) scope in which the interpreter's main program executes — commands read either from standard input, from a script file, or from an interactive prompt. It is this environment in which the idiomatic “conditional script” stanza causes a script to run:if __name__ == "__main__": main()
from 27.5. __main__ — Top-level script environment — Python v2.7.6 documentation #module-__main__
notice the word “stanza”? Here's a technical writing in a technical manual, and in comes a technical term of poetry. This must be a technical humor.
from the few writings of Guido i've seen, am gussing Guido wrote this piece. His writing's always a bit odd.
__main__ is a prototypical hack. It came into being because Python's trying to have a consistent namespace scheme: module has namespace, therefore global stuff must belong to some “module” too, thus this pseudo-module
__main__ was born.
from which, we begot this common nonplus:
if __name__ == "__main__": print "I ran as script!"
- The Idiocy of Python's Function Parameter Specification
- Python Syntax Problem: Complexity of Comment Syntax and Backslash
- Why Python Lambda is Broken and Can't be Fixed
- Syntax Design: Python's Indentation vs Nesting
- Python Bitwise Invert Oddity
- Python Scope Complexity, Shallow Copy, Deep Copy, Circular List, and the Garbage Underneath Computer Languages
- Python's Context Dependent Syntax Soup: 「… in …」 And 「… not in …」
Python Documentation Sucks
- Python Doc Problem: os.system
- Python Doc Problem: os.path.split()
- Python Doc Problem: sort()
- Python Doc Problem: gzip
- Python Documentation Problems
- Python Documentation Author Masturbation
- How to Improve Python Doc; Notes on Rewriting Python Regex Doc
- Why Python's Documentation Sucks
- Python Poetry: the __main__ Stanza
- perldoc Coming of Age, What Python Can Learn From?
- Examples of Quality Documentation in Computing Industry
- Python Doc Links Dead
- Python Doc Links All Dead
- Python = Pretentious Sheet
- Optional Function Parameters in Computer Language Docs (the idiocy thereof)
If you have a question, put $5 at patreon and message me.