[Beginer Question] I heard about python needing somesort of_VariableName_ boiler plate?

MRAB python at mrabarnett.plus.com
Mon Nov 1 19:40:12 CET 2010


On 01/11/2010 18:18, bradenf at hotmail.com wrote:
> Sorry that is what I mean. What is it for?
> Sent wirelessly from my BlackBerry.
>
> -----Original Message-----
> From: MRAB<python at mrabarnett.plus.com>
> Sender: python-list-bounces+bradenf=hotmail.com at python.org
> Date: Mon, 01 Nov 2010 17:33:22
> To:<python-list at python.org>
> Reply-To: python-list at python.org
> Subject: Re: [Beginer Question] I heard about python needing some
> 	sort	of_VariableName_ boiler plate?
>
> On 01/11/2010 04:51, Ben Finney wrote:
>> bradenf at hotmail.com writes:
>>
>>> Sorry, to clarify I heard that when you declare a variable in python
>>> you have to use some sort of standard boiler plate _variable_ however
>>> this has not been my experience using IDLE so is this even true?
>>
>> I don't know what “some sort of boiler plate _variable_” might mean.
>>
>> Can you point to someone's actual message saying this, so we can see
>> what they might be talking about?
>>
> Perhaps the OP means:
>
>       if __name__ == "__main__":
>           ...
>
> although the "declare a variable" bit has me puzzled.

When a module is imported __name__ is bound to the name of the module,
but when the module is run directly __name__ is bound to "__main__".

See: http://docs.python.org/faq/programming.html?highlight=__name__



More information about the Python-list mailing list