[EMAIL PROTECTED] wrote:
> On Feb 19, 11:09 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>> On 19 Feb 2007 09:04:19 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>>
>>> Hi,
>>> I have the following code:
>>> colorIndex = 0;
>>> def test():
>>> print colorIndex;
>>> This won't work
[EMAIL PROTECTED] a écrit :
> On Feb 19, 11:09 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>
>>On 19 Feb 2007 09:04:19 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>>
>>
>>>Hi,
>>
>>>I have the following code:
>>
>>>colorIndex = 0;
>>
>>>def test():
>>>print colorIndex;
>>
>>>T
[EMAIL PROTECTED] a écrit :
> Hi,
>
> I have the following code:
>
> colorIndex = 0;
You don't need the ;
>
> def test():
> print colorIndex;
Idem.
> This won't work.
Why ?
Or more exactly : for which definition of "won't work" ? (hint: this
code prints 0 on sys.stdout - I don't know
| Here is my complete script:
| #!/usr/bin/python
|
| import re
| import sys
| import time
| import os
| import shutil
|
| colors = ["#FF", "#00FF00", "#FF",
| "#00" ,"#FFA500" ,"#DA70D6"]
| colorIndex = 0
|
| def getText( intputstr):
|rc = ""
|
|maxX = 0;
|maxY = 0;
|m
[EMAIL PROTECTED] wrote:
> I have the following code:
>
> colorIndex = 0;
>
> def test():
> print colorIndex;
Don't use ";". It's redundant.
> This won't work. But it works if i do this:
>
> colorIndex = 0;
>
> def test():
> global colorIndex;
> print colorIndex;
>
> My qu
[EMAIL PROTECTED] wrote:
> On Feb 19, 11:09 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>> On 19 Feb 2007 09:04:19 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
>> wrote:
>>
>> >Hi,
>>
>> >I have the following code:
>>
>> >colorIndex = 0;
>>
>> >def test():
>> > print colorIndex;
>>
>>
[EMAIL PROTECTED] wrote:
> Hi,
>
> I have the following code:
>
> colorIndex = 0;
>
> def test():
> print colorIndex;
>
> This won't work. But it works if i do this:
>
Yes, it does work. Can you be more explicit about why you think it doesn't?
(Also, this is Python not C/C++. Get *RID* o
On Feb 19, 11:09 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> On 19 Feb 2007 09:04:19 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> >Hi,
>
> >I have the following code:
>
> >colorIndex = 0;
>
> >def test():
> > print colorIndex;
>
> >This won't work.
>
> Are you sure?
>
>
On 19 Feb 2007 09:04:19 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>Hi,
>
>I have the following code:
>
>colorIndex = 0;
>
>def test():
> print colorIndex;
>
>This won't work.
Are you sure?
[EMAIL PROTECTED]:~$ cat foo.py
colorIndex = 0
def test():
print
Hi,
I have the following code:
colorIndex = 0;
def test():
print colorIndex;
This won't work. But it works if i do this:
colorIndex = 0;
def test():
global colorIndex;
print colorIndex;
My question is why do I have to explicit declaring 'global' for
'colorIndex'? Can't pyth
10 matches
Mail list logo