"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: >> In any case, it is not possible, because the instance method cannot >> know whether its result is being assigned to a name or just thrown >> away. > > This isn't entirely correct - there _are_ ways to know. > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/284742
Not by using the public API, though. The above recipe relies on a number of CPython's implementation details, and will stop working if any of this changes. (I'm sure you're aware of that, but it might not be obvious to some readers.) It also doesn't work when the function is called from C code, or when the unpacking is done in a separate step. -- http://mail.python.org/mailman/listinfo/python-list