Global in multiple files

Artur Skura arturs at iidea.pl
Sun Jun 10 07:21:09 EDT 2001


I'm not a fan of OO but I decided to give it a try. After all, Python
makes it elegant.

So I wrote a program usuing classes, methods etc. All nice. Then it
grew up and I decided to split it in several files - one class into
each class as Guido asked us to do.

And then, I came across my first problem: I had had a global variable
(just one!) and it wouldn't work anymore. At all. Any 'global'
declarations wouldn't help, and without it I'm lost.

So, I thought I might be smarter than it. I would pass this
variable to where I need it, but... it stil obstinately refuses to
work. But then, my ex-global is a list of instances of a class,
and methods in instances of another class won't accept it as
an argument.

So, any ideas how I should cope with that and be able to use my
global variable in different clases in different files?

Regards,
Artur
-- 
http://www.wolneprogramy.org

"Jakos nie kusi mnie perspektywa zostania wsiowym glupkiem
znajacym sie tylko na komputerach i zarabiajacym mnostwo kasy" -- lcamtuf



More information about the Python-list mailing list