static methods

Courageous jkraska1 at san.rr.com
Sat Mar 24 15:37:20 EST 2001


>That it's called "static" is an artifact of C, I believe. In C, "static" 
>has been overexploited such that it has many different meanings in 
>different contexts that have nothing to do with being "static". Hideous 
>example: declaring a function as "static" in C means that it's invisible to 
>code outside of the source file and to all code following it in the same 
>file. :-0

Hrm. I'd forgotten that. In languages where there are no namespaces,
it's useful to be able to make certain that symbols don't go out and
pollute the global namespace in which ALL symbols reside. This is
what that's for.

More generally, "static" in most cases in C and C++ means "global
for the scope that I'm in", err, well, sortof. Examples:

	static class data --> global for the class
	static file data --> global for the file
	static local variables --> global across invocations of the function

I'm in agreement that the keyword "static" is confusing and in some
cases inconsistent.



C//




More information about the Python-list mailing list