[Python-3000] Need help completing ABC pep
Nick Coghlan
ncoghlan at gmail.com
Fri Apr 20 11:49:54 CEST 2007
Guido van Rossum wrote:
> On 4/19/07, Brett Cannon <brett at python.org> wrote:
>> On 4/19/07, Guido van Rossum <guido at python.org> wrote:
>> * "Also pop, popitem, setdefault?"
>>
>> Eh, my gut reaction is "no". But you do have 'pop' on MutableSequence.
>
> But for sequences it trivially maps on core methods. pop() for
> mappings is a little more convoluted (how to pick a random key? Just
> pick the first one I guess?)
pop() on dict requires you to say which key to pop, so a concrete
Mapping.pop might look something like:
_sentinel=object()
def pop(self, k, d=_sentinel):
try:
v = self[k]
except KeyError:
if d is _sentinel:
raise
v = d
else:
del self[k]
return v
>> I really don't like the name of Finite. When I read the name before
>> knowing what it represented I really had no clue what it represented.
>> In hindsight it makes sense, but it not immediately obvious.
>
> I have been playing with Sizeable and Lengthy, but rejected both as
> being too cute. Other suggestions?
Sized? Still not wonderful, but probably easier to figure out and
remember than Finite.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list