da-dada added the comment:
my use case is different (I do a loop), but what I expected from the docs (just
for fun!)
class Ddefault:
def __init__(self):
vars(self).setdefault('default', self.set_default() if not 'default' in
vars(self) else self.defaul
da-dada added the comment:
I have no problem of making my programme run properly (asking first if in dict
etc), but I just read the docu of dict.setdefault
setdefault(key[, default])
If key is in the dictionary, return its value. If not, insert key with a value
of default and return
New submission from da-dada :
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.s
New submission from da-dada :
well, call your module 'stat.py' and python takes over full ownership: it's
somewhat all public..
--
components: Windows
messages: 357444
nosy: da-dada, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
sta