mutable default parameter problem [Prothon]
Christos TZOTZIOY Georgiou
tzot at sil-tec.gr
Thu Jun 17 07:57:27 EDT 2004
On Wed, 16 Jun 2004 21:41:07 -0700, rumours say that "Mark Hahn"
<mark at prothon.org> might have written:
>"Dave Brueck" <dave at pythonapocrypha.com> wrote
>
>> > > I like more as an example:
>> > >
>> > > >>> def foo(x):
>> > > ... if not hasattr(foo,'list'):
>> > > ... foo.list = []
>> > > ... foo.list.append(x)
>> > > ... print foo.list
>> >
>> > In Prothon:
>> >
>> > def foo(x):
>> > print foo.list.append!(x)
>> > foo.list = []
>> >
>> > (Sorry. I couldn't resist bragging.)
>>
>> About what?
>
>Is there an echo in here? :-)
Probably not. Given the python version:
def foo(x):
foo.list.append(x)
print foo.list
foo.list = []
Dave's question is legitimate. Are you bragging about the two lines
combined into one?
--
TZOTZIOY, I speak England very best,
"I have a cunning plan, m'lord" --Sean Bean as Odysseus/Ulysses
More information about the Python-list
mailing list