[New-bugs-announce] [issue38998] dict.setdefault (setdefault of dictionary)

da-dada report at bugs.python.org
Sun Dec 8 13:47:22 EST 2019

New submission from da-dada <georg.klingenberg at travedsl.de>:

from the docu I expected at the second call just a return of value and not a second calculation: there is room for improvement, as Elon Musk would say..

class Ddefault:

    def __init__(self):
        vars(self).setdefault('default', self.set_default())
        vars(self).setdefault('default', self.set_default())

    def set_default(self):
        return 'default'

if __name__ == "__main__":

messages: 358016
nosy: da-dada
priority: normal
severity: normal
status: open
title: dict.setdefault (setdefault of dictionary)
type: enhancement
versions: Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list