Partially evaluated functions

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sun Jul 8 02:25:11 EDT 2001


Sat, 7 Jul 2001 20:07:26 -0700, Scott David Daniels <Scott.Daniels at Acm.Org> pisze:

> The reason for the "depending upon, ..." has to do with whether
> "list + []" must always produce a new list, or is allowed to notice
> that [] is 0-length and simply returns the first list.

IMHO it must produce a new list. It returns a new list in other cases,
so it would be a surprise if it acted differently in this case.

OTOH "tuple + ()" can return "tuple" itself. For immutable types
identity is not important.

Current Python seems to return new objects in both cases - this is
correct but unnecessary for tuples.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list