Re: what does 'a=b=c=' do
- From: rusi <rustompmody@xxxxxxxxx>
- Date: Fri, 23 Dec 2011 00:38:07 -0800 (PST)
On Dec 23, 7:10 am, alex23 <wuwe...@xxxxxxxxx> wrote:
On Dec 22, 6:51 pm, Rolf Camps <r...@xxxxxxx> wrote:
I'm afraid it's dangerous to encourage the use of '' as assignment to
a parameter in a function definition. If you use the function several
times 'default' always points to the same list.
I appreciate the concern, but adding a default argument guard would
not only obscure the code. It's irrelevant, as you recognise, because
no matter what, it's going to make copies of the default argument.
You know what the say about foolish consistencies :)
Programming languages can have bugs as much as programs can.
A classic example is the precedence table of C which Kernighan or
Ritchie (dont remember which) admitted was wrong.
Likewise function arguments that default to mutable entities is a
known gotcha of python which is best treated as a bug in python. It
should be avoided with the suitable additional circumspection that a
language bug deserves over a program bug.
[Just my rephrasing of what Ian is saying]
- Prev by Date: Re: what does 'a=b=c=' do
- Next by Date: Re: IPC with multiprocessing.connection
- Previous by thread: Re: what does 'a=b=c=' do
- Next by thread: Re: what does 'a=b=c=' do