Terry Reedy schrieb:
DaveM wrote:
On Sun, 27 Jul 2008 19:46:32 +0200, "Diez B. Roggisch"
<[EMAIL PROTECTED]>
wrote:
As a rule of thumb, don't return objects you didn't create inside a
function from scratch.
Unless its job is specifically to get/fetch an object (reference
thereto) from someplace the caller cannot or should not access. But
then it should probably not mutate the object before returning the
reference.
I maybe should paraphrase "don't return objects you passed as arguments
from a function". Of course there are exceptions to this rule - but
these are few, the canonical being chained function calls like this:
class Whatever(object):
def do_something(self, arguments):
....
return self
Diez
--
http://mail.python.org/mailman/listinfo/python-list