[Tutor] using global variables with functions

Dutcher, John John_Dutcher at URMC.Rochester.edu
Fri Dec 5 10:56:34 EST 2003


	Hello Tutor,

	Can you comment on this issue ?

	Using Python 2.3.1, I carefully import 'string' along with other
modules.

	The interpreter will NOT let me use any 'string' functions in the
code,
	(i.e. upper(), lower(), capitalize() etc.)

	It indicates no 'global string' defined.

	In a couple other scripts I coaxed it to let me use 'string.rstrip'
but
	ONLY by doing away with a couple user functions I had positioned
	at the top of the script....and handling the same code 'inline'.

	I hate to be locked into that mode always. I assume there is some
	fundamental concept that relates to using your own 'defs', and how
	they confuse the interpreter and prevent it from recognizing the
	import of  'string'. The concept of having 'masked' it away in my
	own code arises I guess....but I have no variables named 'string'
	or named any of the 'string' functions either ?????

	Thanks,     John Dutcher 
	
	



More information about the Tutor mailing list