Thanks Walter; I believe I understand the reasoning behind it, though not
all of the mechanics, but for now, your answer is more than sufficient.
-Alex
On Thu, Jun 14, 2012 at 4:10 PM, Walter Prins wrote:
> Hi Alex,
>
> On 14 June 2012 23:18, Alexander Quest wrote:
> > if __name__ == '__main__
On 14/06/12 23:18, Alexander Quest wrote:
so far, there is no variable called "_name_", and even if there was,
why is it comparing it to "_main_"? Why can't the main function just
Note that in both cases there are two '_' characters before and after
the name. __name__ and '__main__'.
On 6/14/2012 3:18 PM Alexander Quest said...
[Resending because I messed up on last email]
My question was regarding a piece of boilerplate code:
if __name__ == '__main__':
main()
__name__ within a python module is either '__main__' when invoked
directly from a command line, or contains
Hi Alex,
On 14 June 2012 23:18, Alexander Quest wrote:
> if __name__ == '__main__':
> main()
>
> This calls the main function, but I don't understand what the 'if' statement
> is doing here. In the simple programs that I've seen this so far, there is
> no variable called "_name_", and even if t
On 06/14/2012 06:18 PM, Alexander Quest wrote:
> [Resending because I messed up on last email]
>
> My question was regarding a piece of boilerplate code:
>
> if __name__ == '__main__':
> main()
>
> This calls the main function, but I don't understand what the 'if'
> statement is doing here. In
[Resending because I messed up on last email]
My question was regarding a piece of boilerplate code:
if __name__ == '__main__':
main()
This calls the main function, but I don't understand what the 'if'
statement is doing here. In the simple programs that I've seen this so far,
there is no vari
Got it Dave- sorry about not sending it to the newsgroup as well.
My question was regarding a piece of boilerplate code:
if __name__ == '__main__':
main()
This calls the main function, but I don't understand what the 'if'
statement is doing here. In the simple programs that I've seen this so f
On 06/07/2012 02:36 PM, Alexander Quest wrote:
> Ok, thanks guys. I also had one more quick question regarding a piece of
> boilerplate code:
>
To get a response, you will needs to leave your question at the python
tutor newsgroup. We are part of a group, not offering private advice.
Normally,
Marc Tompkins wrote on 07 June 2012 at 08:53:-
> In Notepad++, select Settings/Preferences.
> There's a tab called "Language Menu/Tab Settings" (they've put the two things
> on
> one tab to save space; the tab settings are on the right side.) You'll find a
> setting for "Tab size"; the default
I don't use notepad or notepad++, so I don't know the settings. However, if
you're familiar with vi/vim, you can download the CLI from www.vim.org for
almost any flavor OS and it works quite well on Windows.
BTW: you can customize your settings to use spaces instead of tabs, among
others, which is
Hi, as a Python beginner myself, I started out using Geany IDE. It was
pretty cool editor but it caused me indentation hell! Since then I have
moved to eclipse with the pydev plugin and found it much friendlier when
dealing with indentation problems. But each to there own! Notepad!! is a
sweet edit
On Thu, Jun 7, 2012 at 12:41 AM, Alan Gauld wrote:
> This is almost certainly down to mixing tabs and spaces.
> You can mix them in a file but not within a block. (And
> even then I would recommend sticking to just one style)
> Some editors make it worse by autoindenting with a mixture
> of tabs a
On 07/06/12 05:29, Alexander Quest wrote:
Hey all; my question is regarding editing Python code in Notepad++. When
I run this piece of code in Notepad++:
def fix_start(s):
var1 = s[0]
var2 = "*"
var3 = s.replace(var1, var2)
return var3
I get an indentation error, which reads:
On 06/07/2012 12:29 AM, Alexander Quest wrote:
> Hey all; my question is regarding editing Python code in Notepad++. When I
> run this piece of code in Notepad++:
>
> def fix_start(s):
> var1 = s[0]
> var2 = "*"
> var3 = s.replace(var1, var2)
>
> return var3
>
>
> I get an indentation err
14 matches
Mail list logo