On 1/12/07, Larry Hastings <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > Changing the API is the only reasonable solution amongst all the options > I've seen. I defer to you. Perhaps another approach will surface; in the > meantime I'll start on the API change. > > You suggested changing the name as a reminder of the semantics change. Are > you interested in a structural change too? My personal aesthetic for APIs > is to return success/failure separately from output parameters. So I > propose something this: > #define PyUnicode_VALUE(self, p, len) > which would return nonzero on success and zero on failure. If it fails, p > and len would be unchanged.
I like having a functionm (not macro) that returns pointer and length through output variables. Yould call it as PyUnicode_Value(self, &p, &len). I don't like having a separate 'success' return value; in that case, you could just set p to NULL and len to -1. Or if you like shortcuts, you could make p the return value and len an output parameter, or vice versa. Experiment, see what results in the cleanest code in typical usage. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
