On Sun, 29 Apr 2007 07:32:44 -0400, Bart Willems wrote:
> gtb wrote:
>> appear at the end of many examples I see. Is this to cause a .class
>> file to be generated?
> This might be obvious, but no one else mentioned it: the Python
> interpreter cannot execute code that it hasn't compiled yet, whi
Bart Willems <[EMAIL PROTECTED]> wrote:
> gtb wrote:
>> appear at the end of many examples I see. Is this to cause a .class
>> file to be generated?
> This might be obvious, but no one else mentioned it: the Python
> interpreter cannot execute code that it hasn't compiled yet, which is
> why the
On Apr 29, 9:32 pm, Bart Willems <[EMAIL PROTECTED]> wrote:
> gtb wrote:
> > appear at the end of many examples I see. Is this to cause a .class
> > file to be generated?
>
> This might be obvious, but no one else mentioned it: the Python
> interpreter cannot execute code that it hasn't compiled ye
gtb wrote:
> appear at the end of many examples I see. Is this to cause a .class
> file to be generated?
This might be obvious, but no one else mentioned it: the Python
interpreter cannot execute code that it hasn't compiled yet, which is
why the "if __name__ ..." code is always at the end of the
alisonken1 wrote:
[if __name__ == "__main__"]
> These are samples to give the programmer an idea of how the code
> is supposed to work.
No, this belongs into comments or docs. The contents of this block
are often used for testing or debugging, or for normally executable
code if it makes sense to
Sorry for the wrong implication. I should have said I 'mimicked the
style'.
No, not used to Java at all, and obviously not versed in python either
(do I get points for tcl?). Maxq generates jython scripts and when I
saw the .class files I assumed it was the work of the python compiler
as what is v
On Apr 27, 2:08 pm, gtb <[EMAIL PROTECTED]> wrote:
> The lines
>
> if __name__ == 'main':
>someClass().fn()
>
> appear at the end of many examples I see. Is this to cause a .class
> file to be generated?
>
These are samples to give the programmer an
> The lines
>
> if __name__ == 'main':
>someClass().fn()
>
> appear at the end of many examples I see. Is this to cause a .class
> file to be generated?
Python doesn't generate .class files, and the example you mean is
probably more like
if __name__
The lines
if __name__ == 'main':
someClass().fn()
appear at the end of many examples I see. Is this to cause a .class
file to be generated?
The last line of the sample below has a string parameter. When I
mimicked this I got an error stating that the class constructor did
not t
On Mar 20, 12:13 pm, "Patrick Down" <[EMAIL PROTECTED]> wrote:
> On Mar 20, 11:49 am, "gtb" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I often see the following 'if' construct in python code. What does
> > this idiom accomplish? What happens if this is not main? How did I get
> > here if it is not
On Mar 20, 11:49 am, "gtb" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I often see the following 'if' construct in python code. What does
> this idiom accomplish? What happens if this is not main? How did I get
> here if it is not main?
A quick example demonstrates the usage:
C:\code>type temp.py
prin
s is not main?
Nothing.
> How did I get here if it is not main?
By importing the file.
> if __name__ == 'main':
>myQuest('myQuest').Run()
>
--
Grant Edwards grante Yow! Thank god!!... It&
gtb wrote:
> I often see the following 'if' construct in python code. What does
> this idiom accomplish? What happens if this is not main? How did I get
> here if it is not main?
> ...
> if __name__ == 'main':
>myQuest('myQuest').Run()
This i
Hi,
I often see the following 'if' construct in python code. What does
this idiom accomplish? What happens if this is not main? How did I get
here if it is not main?
Thanks,
gtb
======
if __name__ == 'main':
myQuest('
14 matches
Mail list logo