sneekula 969 Nearly a Posting Maven

With the ease of argument passing to and from functions in Python, why would anyone want to use global variables. Isn't that an open invitation for mistakes to happen? Yet, I see code in threads here that abound with globals. I am a little confused here.

sneekula 969 Nearly a Posting Maven

Wow, Python makes multiple argument passing simple!
So, when you say:

# or unpack into a tuple of appropriate variables
tuple, sum, average = sum_average(2, 5, 6, 7)

It has to match the function's return arguments:

return args, sum, sum/float(size)

Also, do you return the argument tuple passed to the function just to aid in the display of the results?

sneekula 969 Nearly a Posting Maven

Thank you! That works just fine!

sneekula 969 Nearly a Posting Maven

How to I best pass multiple arguments to and from a function?

sneekula 969 Nearly a Posting Maven

Okay, I get it. On the display the string and the xrange object came up looking alike. That confused me! Thanks for the insight on using the xrange() function. It's all new to me and I will keep asking "not so smart questions" a lot!

sneekula 969 Nearly a Posting Maven

I have played with Python code just a little and like it so far. I am using a Windows XP machine and have downloaded Python 2.5. As recommended in the "Starting Python" thread, I am saving my test files in the directory C:\Python25\Atest\.

When I bring up the IDLE editor, I would like it to come up with this directory. Is there a way to do this?

sneekula 969 Nearly a Posting Maven

I thought function xrange would give me a list of integers, but I got a string instead:

x = "xrange(1, 5)"
print x           # xrange(1, 5)
x = xrange(1, 5)
print x           # xrange(1, 5) same result as string above!?