Re: what does 'a=b=c=[]' do



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]
.



Relevant Pages

  • Re: ASP.NET Internationalization bug?
    ... The Microsoft team has confirmed the bug. ... For every programming team that works like you do, ... I don't see too clearly the purpose of declaring a single language ... appropriate as HTML and XHTML standards. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Crash, crash, hang, crash, hang,...
    ... If there are any really good programming suppliers in India, ... Fault tracking utility built into Solidworks: ... the lost time of end users when a bug causes them problems, ... I have no idea what percentage of SWks users do ...
    (comp.cad.solidworks)
  • Re: ASP.NET Internationalization bug?
    ... I'm trying to explain why your, or my, workaround to the bug I've found is ... inline programming in .aspx pages is just as effective as ... I don't see too clearly the purpose of declaring a single language ... HTML and XHTML standards. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Python syntax in Lisp and Scheme
    ... might be a challenge without macros. ... "properties" are in Python, possibly they are built for exactly that. ... Discovered there was a bug in the generated code? ... probably never miss it during your programming. ...
    (comp.lang.python)
  • Re: Python syntax in Lisp and Scheme
    ... might be a challenge without macros. ... "properties" are in Python, possibly they are built for exactly that. ... Discovered there was a bug in the generated code? ... probably never miss it during your programming. ...
    (comp.lang.lisp)