vladimir <golubovic.vladimir...@gmail.com> added the comment:

On Sat, Aug 28, 2010 at 12:34 AM, Georg Brandl <rep...@bugs.python.org>wrote:

changes parameter value. It' would be understandable, as exmple in
documentation with acumulating value of L, that changing parameter in side
class affect default
    value in next call. But this is out of mind. Did you try to execute
program on your computer? Does it give same output? I rather consider it
bug. Languages like python should be semanticly understandable, without
knowing how
    something works. I read that van Rossum working on it ( clearing
something  ) in version 3.0, did you try it? Does verison 3.0 correct this?

----------
Added file: http://bugs.python.org/file18668/unnamed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9703>
_______________________________________
<br><br><div class="gmail_quote">On Sat, Aug 28, 2010 at 12:34 AM, Georg Brandl 
<span dir="ltr">&lt;<a 
href="mailto:rep...@bugs.python.org";>rep...@bugs.python.org</a>&gt;</span> 
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid 
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Georg Brandl &lt;<a href="mailto:ge...@python.org";>ge...@python.org</a>&gt; 
added the comment:<br>
<br>
This is by design.  Parameter default values are evaluated when the function 
is defined, not when it is called.  Therefore, by assigning the default value 
to an instance attribute, you are basically sharing it between instances.<br>

<br>
</blockquote><div>    It&#39;s totaly unexpected that changing attribute 
with difrent name changes parameter value. It&#39; would be understandable, as 
exmple in documentation with acumulating value of L, that changing parameter in 
side class affect default<br>
    value in next call. But this is out of mind. Did you try to execute 
program on your computer? Does it give same output? I rather consider it bug. 
Languages like python should be semanticly understandable, without knowing 
how<br>
    something works. I read that van Rossum working on it ( clearing 
something  ) in version 3.0, did you try it? Does verison 3.0 correct 
this?<br> </div></div><br>
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to