On 2007-10-26, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> Neil Cerutti a écrit :
>> On 2007-10-25, Bruno Desthuilliers
>> <[EMAIL PROTECTED]> wrote:
>>> The canonical case for small scripts is to have first all
>>> functions and globals defined, then the main code protected by
>>> a guard, ie
Neil Cerutti a écrit :
> On 2007-10-25, Bruno Desthuilliers
> <[EMAIL PROTECTED]> wrote:
>> The canonical case for small scripts is to have first all
>> functions and globals defined, then the main code protected by
>> a guard, ie:
>
> There's no reason to "protect" your main code in a small scrip
On 10/25/07, Neil Cerutti <[EMAIL PROTECTED]> wrote:
> On 2007-10-25, Bruno Desthuilliers
> <[EMAIL PROTECTED]> wrote:
> > The canonical case for small scripts is to have first all
> > functions and globals defined, then the main code protected by
> > a guard, ie:
>
> There's no reason to "protect"
On 2007-10-25, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> The canonical case for small scripts is to have first all
> functions and globals defined, then the main code protected by
> a guard, ie:
There's no reason to "protect" your main code in a small script.
> if __name__ == '__main__':
>
NoName a écrit :
> sorry! Yes it's work.
> What about 2 question?
> Can i put function after main block?
>
> print qq()
>
> def qq():
> return 'hello'
Where's your "main block" here ?
> Traceback (most recent call last):
> File "C:\Python25\projects\indexer\test.py", line 1, in
> print
NoName wrote:
> sorry! Yes it's work.
> What about 2 question?
> Can i put function after main block?
> print qq()
>
> def qq():
> return 'hello'
You can't call a thing before it is defined.
> Traceback (most recent call last):
> File "C:\Python25\projects\indexer\test.py", line 1, in
>
sorry! Yes it's work.
What about 2 question?
Can i put function after main block?
print qq()
def qq():
return 'hello'
Traceback (most recent call last):
File "C:\Python25\projects\indexer\test.py", line 1, in
print qq()
NameError: name 'qq' is not defined
Or onli possible:
def main()
On Oct 25, 10:30 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
[...]
> "look for the object currently bound to the name 'b' in the
> global dictionary, and execute the __call__ method of that object with
> no arguments"
This is what happens at runtime. Rereading, I thought I hadn't made
it clea
On Oct 25, 7:28 am, NoName <[EMAIL PROTECTED]> wrote:
> I try it:
>
> def b():
> ...
> a()
> ...
>
> def a():
> ...
> b()
> ...
>
> b()
> it's not work.
Probably all those dots!
> Is it possible pre-define function like in c++ or place functions code
> after main block?
Python binds
On Thu, 25 Oct 2007 06:28:16 +, NoName wrote:
> I try it:
>
> def b():
> ...
> a()
> ...
>
> def a():
> ...
> b()
> ...
>
> b()
> it's not work.
What do you mean by not working? At the time `b()` is called, both
functions are defined so it should working. Or at least it's not
On Oct 25, 2:28 am, NoName <[EMAIL PROTECTED]> wrote:
> I try it:
>
> def b():
> ...
> a()
> ...
>
> def a():
> ...
> b()
> ...
>
> b()
> it's not work.
It sure does. Please post full code and error message, something else
is wrong, not the cyclic reference.
George
--
http://mail.p
NoName schrieb:
> I try it:
>
> def b():
> ...
> a()
> ...
>
> def a():
> ...
> b()
> ...
>
> b()
> it's not work.
It works.
def a():
print "a"
b()
def b():
print "b"
print a # not calling!
b()
But if you really call a in b, you create an endless loop. I
I try it:
def b():
...
a()
...
def a():
...
b()
...
b()
it's not work.
Is it possible pre-define function like in c++ or place functions code
after main block?
int a();
int b();
int main ()
{
...
a();
...
}
int a()
{
...
b();
...
}
int b()
{
...
a();
...
}
=) sorry for my eng;)
13 matches
Mail list logo