Ron wrote:
On Tue, 22 Mar 2005 21:56:57 GMT, Ron <[EMAIL PROTECTED]> wrote:


Why should a function not create a local varable of an argument if the
varable doesn't exist and a default value is given?


ok... thought it out better. :)

Getting a default into a function isn't the problem. Returning the
value to a varable that doesn't exist is.

So then the question is ... is there a way for a function to create a
varable in it's parents namespace that persists after the function is
done?

yes, that'w called a global, and it's UGLY(tm)

>>> def yuck():
...     global G
...     G = 42
...
>>> G
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: name 'G' is not defined
>>> yuck()
>>> G
42
>>>

Anyone doing such a thing in my team would be shoot down at once !-)

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to