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

Tim Peters tim.one at comcast.net
Thu Sep 11 23:22:26 EDT 2003


[Tony Meyer]
> 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.

Good point!  Python actually acts as if the declaration were floated up to
the top of the block defining the function.

> I do understand that even in C++ it's not good practice, and will in
> future place my imports where they belong.

There are worse sins, Tony -- it was an easy mistake to fall into, and
especially if you read Mark's code <wink>.




More information about the spambayes-dev mailing list