r0g <aioe....@technicalbloke.com> writes: > Steven D'Aprano wrote: >> On Tue, 05 Jan 2010 02:31:34 +0000, r0g wrote: >> >>> A pattern I have used a few times is that of returning an explicit >>> success/failure code alongside whatever the function normally returns. >> >> That doesn't work for languages that can only return a single result, >> e.g. C or Pascal. You can fake it by creating a struct that contains a >> flag and the result you want, but that means doubling the number of data >> types you deal with. > > > No, but that's why I try not to use languages where you can only return > a single result, I always found that an arbitrary and annoying > constraint to have. I leads to ugly practices like "magic" return values > in C or explicitly packing things into hashtables like PHP, yuk!
Doesn't python just return a single result? (I know it can be a tuple and assignment statements will unpack a tuple for you.) -- http://mail.python.org/mailman/listinfo/python-list