[spambayes-dev] Re: [Spambayes-checkins]spambayes/spambayesstorage.py, 1.31, 1.32

Meyer, Tony T.A.Meyer at massey.ac.nz
Fri Sep 12 15:09:22 EDT 2003


> Actually not, and the failure could have been much worse in 
> C.  A C lookalike would be
> 
> int sys = 4;
> 
> int whatever()
> {
>     int sys;
>     call_something(sys);
>     sys = 3;
> }
> 
> whatever();

Ok, so I meant C++:

int sys = 4;                 # sys = 4

int whatever()               # def whatever():
{
	call_something(sys);   #     call_something(sys)
	int sys = 3;           #     sys = 3
}

int main()
{
	whatever();            # whatever()
}

Where until the local "int sys" the sys referred to is the global one,
and then after that it's the local one.  This is what the Python *looks*
like (since the "int sys" in the C example isn't in the Python),
although not what it is actually like.  I do understand that even in C++
it's not good practice, and will in future place my imports where they
belong.

=Tony Meyer



More information about the spambayes-dev mailing list