Am Tue, 21 Sep 2010 11:35:14 -0700 (PDT)
schrieb joblack <tobias.ko...@gmail.com>:

> Let's say I've got a function with
> 
> def doesSomething(A='bla'):
> ...
> 
> and I try to call it with a non existent variable with
> 
> doesSomething(DoesNotExist)
> 
> What will happen? Will it throw an exception or will it take the
> defautl value?

The interpreter is omniscient, just ask him:

Python 2.6.6 (r266:84292, Aug 29 2010, 12:36:23) 
[GCC 4.4.5 20100824 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> def doesSomething(A='bla'):
...     pass
... 
>>> doesSomething(DoesNotExist)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'DoesNotExist' is not defined


--
Greg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to