[Python-3000] Need help completing ABC pep (original) (raw)

Brett Cannon brett at python.org
Fri Apr 20 21:21:18 CEST 2007


On 4/19/07, Guido van Rossum <guido at python.org> wrote:

I've started a PEP on Abstract Base Classes (ABCs), PEP 3119:

http://www.python.org/dev/peps/pep-3119/ While I'm not ready yet to answer tough questions about this compared to alternative proposals, I am ready for feedback on the various open issues sprinkled throughout the current text, especially concerning decisions regarding exactly which operations to include in the various ABCs, and also regarding the level of detail required in the PEP.

Just noticed your latest checkin asks whether to unify 'remove' and 'discard' for sets. I say yes. If people care about whether the item pre-exists or not they can check if the item is contained in the set since it implements Container. So either have it throw an exception if the item does not exist or return a boolean based on whether something was remove ala Java. But I don't see a need for both when the check is as simple as::

set.remove(item) if item in set else None

or something along those lines.

-Brett



More information about the Python-3000 mailing list