[Python-ideas] dict(default=int)
Dan Sommers
dan at tombstonezero.net
Wed Mar 8 18:22:13 EST 2017
On Thu, 09 Mar 2017 09:43:48 +1100, Chris Angelico wrote:
> On Thu, Mar 9, 2017 at 9:39 AM, Brice PARENT wrote:
>> But a possible workaround, is if we used the first positional
>> argument of dict() as the default value [...]
> ... Granted, there aren't going to be very many objects that are both
> callable and iterable ...
Many stream-like objects are both callable (get the next element of the
stream) and iterable (iterate through the remainder of the stream). Or
at least that's the way I make mine. Sometimes.
> Safer to keep this out of the signature of dict itself.
Agreed.
Dan
More information about the Python-ideas
mailing list