Re: Please explain Python "__whatever__" construct.

2008-06-16 Thread Matimus
When and why would I ever use > "__main__" or the many other "__whatever__" constructs? You don't generally use those names directly, they are 'magic'. The __add__ example is a good one. When you do `"hello " + "world"` behind the scenes python is actually calling "hello ".__add__("world"). There

Re: Please explain Python "__whatever__" construct.

2008-06-16 Thread s0suk3
On Jun 16, 4:56 pm, [EMAIL PROTECTED] 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

Re: Please explain Python "__whatever__" construct.

2008-06-16 Thread Benjamin Kaplan
On Mon, Jun 16, 2008 at 5:56 PM, <[EMAIL PROTECTED]> 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 s

Re: Please explain Python "__whatever__" construct.

2008-06-16 Thread Jason Scheirer
On Jun 16, 2:56 pm, [EMAIL PROTECTED] 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

Please explain Python "__whatever__" construct.

2008-06-16 Thread bsagert
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 con