Python has no concept of declarations.
And it doesn't have arrays, it has dynamically-resizing lists.
Some examples:
one_empty_list = []
a_list_of 5 zeroes = [0]*5
Might I recommend you read the Python tutorial? I will help you in
your programming class.
Cheers,
Chris
--
http://blog.rebertia.com
Heh. I must remember to never state "python does not have X" - it
almost always has X, I just don't know where yet ;)
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
twitter.com/olofb
olofb.wordpress.com
olofb.wordpress.com/tag/english
I should have qualified that statement... :)
As others have mentioned, you do not have concept of declaration. But
if you are looking for creating a global variable, it is like any
other language. Declare the same in a module, outside any procedures
or classes.
But, please note that it is not completely global. You have to go
inside the modules namespace to get it.
So, it will be like
Module A:
l = []
Module B:
import A
A.l ==> This is the global variable you are looking for.
To explain it further, every variable lives in a namespace. The
namespace can be that of a module (which is the global thing you are
looking for, I guess), or a class/object or even a procedure.
There is also a global keyword etc if that is what you are looking
for. Check out python documentation for more details.
HTH
K
Now you can use myList everywhere in your code.
Note that modifying __builtin__ is **not** recommended at all. I don't
have time to detail that point, google it if you want the answer. I
warned you :o)
JM