harold fellermann wrote:

Hi,

I cannot see any strange behavior. this code works exacly as you and I suspect:

 >>> def otherfunction(x) :
....     return x
....
 >>> def function(arg=otherfunction(5)) :
....     return arg
....
 >>> function(3)
3
 >>> function()
5

Or is this not what you excepted?


Channelling the effbot, I think he was asking what namespace context you expected the expression "arg=otherfunction(x)" to be evaluated in when it's used at the time of a function call to dynamically create a new default value for arg.


regards
 Steve
--
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to