very good reasons?
"Jürgen A. Erhard"
juergen.erhard at gmx.net
Mon Oct 2 06:19:07 EDT 2000
>>>>> "Glyph" == Glyph Lefkowitz <glyph at no.spam> writes:
Glyph> Grant Griffin <g2 at seebelow.org> writes:
>> >If you could write
>> >
>> > sorted_arr = arr.sort()
>> >
>> >then people might get surprised that arr changed.
>>
>> Well, I had thought of that, but it didn't really seem compelling to me: I can't
>> find anything in Tim's "Python Philosophy"* that it specifically violates.
>>
>> (unlike-some-of-2.0's-new-features-<wink>)-ly y'rs,
Glyph> "Explicit is better than implicit."
Glyph> If you say "sorted = arr.sort(); foo(sorted)", you're only implying
Glyph> that arr changed, whereas if you say "arr.sort(); foo(arr)" you're
Glyph> stating it explicitly.
If I see "sorted = arr.sort();" I assume arr is unmodified... so
nothing's implicit.
I like the "non-destructive is the most natural" philosophy of
(Common) Lisp better than ".sort is destructive" (= in-place).
Bye, J
--
Jürgen A. Erhard juergen.erhard at gmx.net phone: (GERMANY) 0721 27326
MARS: http://members.tripod.com/Juergen_Erhard/mars_index.html
WARNING: The Surgeon General has determined
that whatever you have in mind is bad for you
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 248 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20001002/2099e842/attachment.sig>
More information about the Python-list
mailing list