"Bob Then" <[EMAIL PROTECTED]> wrote:
>If I have a module File
>which has some fucontions but I need globals filename and path how can I
>set them so I can change them because I tryed.
>
>filename="log.txt"
>path="/home/Bob/"
>
>def change_filename():
global filename
> filename=raw_input()
>
>def change_path():
global path
> path=raw_input()
>
>they don't change and without the declarations there not global.
However, the reason that must be stated explicitly is because it's a bad
practice. It means that your function has "side effects" beyond just
returning a value or set of values. This kind of thing is a better
solution:
def change_filename():
return raw_input()
def change_path()
return raw_input()
filename = change_filename()
path = change_path()
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list