On Dec 13, 2004, at 17:15, Florent Guillaume wrote:
Can we have instead:

    def getUserById(self, id, default=_marker):
        """Return the user corresponding to the given id.

        Raises a KeyError if the user does not exist and no default
        is provided.
        user = self.getUser(id)
        if user is not None:
            return user
        if default is not _marker:
            return default
        raise KeyError(id)

What is the advantage of throwing a KeyError over simply returning None? I don't see the reason for "getUser" and "getUserById" behaving in different ways here. They should both behave similar.


Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to