Please explain Python "__whatever__" construct.
jason.scheirer at gmail.com
Tue Jun 17 00:11:44 CEST 2008
On Jun 16, 2:56 pm, bsag... at gmail.com wrote:
> After a couple of weeks studying Python, I already have a few useful
> scripts, including one that downloads 1500 Yahoo stock quotes in 6
> seconds. However, many things are puzzling to me. I keep on seeing
> things like "__main__" in scripts. A more obscure example would be
> "__add__" used in string concatenation. For example, I can use "Hello
> "+"world (or just "Hello" "world") to join those two words. But I can
> also use "Hello ".__add__("world"). When and why would I ever use
> "__main__" or the many other "__whatever__" constructs?
More information about the Python-list