Chris's Wiki :: blog/python/DefaultArgumentDanger Commentshttps://utcc.utoronto.ca/~cks/space/blog/python/DefaultArgumentDanger?atomcommentsDWiki2012-11-08T18:38:26ZRecent comments in Chris's Wiki :: blog/python/DefaultArgumentDanger.By Chris Siebenmann on /blog/python/DefaultArgumentDangertag:CSpace:blog/python/DefaultArgumentDanger:3cb36acd611ed2e59afc4e7b78bffb13861e30b8Chris Siebenmann<div class="wikitext"><p>I think I've been unclear in the original entry. I don't think that
default parameters are dangerous by themselves. What's dangerous (in my
example) is using default values for parameters that aren't actually
optional in practice, in situations where I should be supplying a value
all the time (and they're dangerous for the reason that I highlighted;
they hide argument count errors like not supplying that 'in practice not
optional' new parameter).</p>
</div>2012-11-08T18:38:26ZFrom 89.70.184.230 on /blog/python/DefaultArgumentDangertag:CSpace:blog/python/DefaultArgumentDanger:063c1493911d2068ba369a1061a04305c5f7b438From 89.70.184.230<div class="wikitext"><blockquote><p>[...] 'changing function semantics' is an awfully abstract description of the problem [...]</p>
</blockquote>
<p>I agree completely. I don't like this description either, because it doesn't provide any sensible way of avoiding the problem in the future. I just couldn't agree to boil the problem down to simple "default params are dangerous" statement.</p>
</div>2012-11-04T12:53:01ZBy Chris Siebenmann on /blog/python/DefaultArgumentDangertag:CSpace:blog/python/DefaultArgumentDanger:103cfeaf25b39eccd670d19bcc64aa14949a0002Chris Siebenmann<div class="wikitext"><p>My (delayed) reaction is that 'changing function semantics' is an
awfully abstract description of the problem I ran into, one that covers
a large amount of ground. If we want to talk abstractions, I'd say
that the real problem is not that I changed function semantics but
that I half-changed them, leaving the old semantics intact as well as
introducing new ones.</p>
<p>(I was lucky in my debugging in that I was applying the program and
thus the old semantics to an area where they didn't work at all, as
opposed to an area where they worked but gave subtly wrong results.)</p>
</div>2012-10-31T22:36:54ZFrom 91.198.246.11 on /blog/python/DefaultArgumentDangertag:CSpace:blog/python/DefaultArgumentDanger:a0e7ac9d95d68e86cc11eb79a431f20511a85cc4From 91.198.246.11<div class="wikitext"><p>It's not related to default parameters. It's an issue related to changing function semantics without changing its syntax. The same would apply if you haven't added the optional parameter.</p>
</div>2012-10-18T07:53:20Z