[Tutor] Fixing Globals

Mitya Sirenef msirenef at lightbird.net
Sat Mar 16 21:01:53 CET 2013


On 03/16/2013 03:04 PM, kendy at kendy.org wrote:
> START = '<'
 > END = '>'
 >
 > def getargs():
 > getops()
 > if
 > in_filename_1 =
 > in_filename_2 =
 > out_filename_1 =
 > out_filename_2 =
 > flag1 =
 > verbose =
 >
 > def this():
 > open_for_read()
 > stuff()
 >
 > def open_for_read(filename):
 > in_filehandle = open(
 > return in_filehandle
 >
 > def stuff():
 > if c == START or c == END:
 > foo_the_bar =
 >
 > def that():
 > things()
 > write_status(out_filename_1)
 >
 > def things():
 > bar_the_foo = foo_the_bar
 > if verbose:
 > print(flag1)
 >
 > def write_status(out_filename_1):
 >
 > getargs()
 > this()
 > that()


Create a class or a few, instantiate them and all of
your data will be instance properties.

  -m



-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/

Each religion, by the help of more or less myth, which it takes more or
less seriously, proposes some method of fortifying the human soul and
enabling it to make its peace with its destiny.  George Santayana



More information about the Tutor mailing list