Re: Unexpected default arguments behaviour (Maybe bug?)

2008-07-18 Thread sukkopera
FYI, I have opened a bug on the official tracker: http://bugs.python.org/issue3403. -- http://mail.python.org/mailman/listinfo/python-list

Re: Unexpected default arguments behaviour (Maybe bug?)

2008-07-18 Thread sukkopera
On 18 Lug, 13:23, Sebastian \lunar\ Wiesner [EMAIL PROTECTED] wrote: It _is_ the correct thing.  Evaluation of default parameters at declaration time and not at invocation is truely a language feature, not a bug. You'll find your bug report being closed quickly. It has ;). I had totally

[issue3403] Unexpected default arguments behaviour

2008-07-18 Thread SukkoPera
New submission from SukkoPera [EMAIL PROTECTED]: I have just encountered a Python behaviour I wouldn't expect. Take the following code: class Parent: a = 1 def m (self, param = a): print

Re: subprocess module

2008-07-14 Thread sukkopera
On 14 Lug, 10:34, Peter Otten [EMAIL PROTECTED] wrote: John Mechaniks wrote: from subprocess import call call(['ls', '-l']) How do I get the result (not the exit status of the command) of ls - l into a variable? output = subprocess.Popen([ls, -l], stdout=subprocess.PIPE).stdout.read()

Unexpected default arguments behaviour (Maybe bug?)

2008-07-13 Thread sukkopera
Hi, I have just encountered a Python behaviour I wouldn't expect. Take the following code: class Parent: a = 1 def m (self, param = a): print param = %d % param class Child (Parent):

Re: Unexpected default arguments behaviour (Maybe bug?)

2008-07-13 Thread sukkopera
On 13 Lug, 19:42, [EMAIL PROTECTED] wrote: I expect it's because default values for parameters are evaluated and bound at definition time. So once def m (self, param = a): line executes, the default value for parameter is forever bound to be 1. What you can do is for example: Yes, that's what