[Tutor] functions and default argument
Christian Witts
cwitts at compuscan.co.za
Fri Oct 21 15:19:39 CEST 2011
On 2011/10/21 03:00 PM, Praveen Singh wrote:
> In function-
>
> "Default value is *evaluated only once*.This makes different when the
> default is a mutable object such as a list, dictionary or instance of
> most classes."
>
> I am not getting it properly-evaluated once?? different behaviour???--
> please explain this.
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
Mutable defaults for function/method arguments is a Python Gotcha, you
can find a good read here [1]. It's a better read than how I would
explain it.
[1] http://www.ferg.org/projects/python_gotchas.html#contents_item_6
--
Christian Witts
Python Developer
//
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111021/2c790f93/attachment.html>
More information about the Tutor
mailing list