Good style for multi-valued returns
Aahz Maruch
aahz at netcom.com
Thu Apr 20 16:25:42 EDT 2000
In article <889A6EB6AE399393.619B0539BFCAAE0F.5C6D110C3DA908F7 at lp.airnews.net>,
Cameron Laird <claird at starbase.neosoft.com> wrote:
>
>Examples of multi-valued returns: (head, tail); (quotient, remainder);
>(left, right); (prologue, body, epilogue); (data, code); (CAR, CDR);
>(count, size); (handle, status); (decomposition; remainder); ...
>
>Let me guess: folks generally pass tuples for small and
>determinate-in-number multi-values, and dictionaries otherwise, 'cept
>some do it all with tuples. Accurate?
Somewhat. There's also the option of returning a class (though that
usually ends up being a class instantiation followed by a method call).
--
--- Aahz (Copyright 2000 by aahz at netcom.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
Why is this newsgroup different from all other newsgroups? --Aahz
More information about the Python-list
mailing list