python - TypeError: get() takes no keyword arguments -


i'm new @ python, , i'm trying make hash table checks if key points value in table, , if not, initializes empty array. offending part of code line:

converted_comments[submission.id] = converted_comments.get(submission.id, default=0) 

i error:

typeerror: get() takes no keyword arguments 

but in documentation (and various pieces of example code), can see take default argument:

https://docs.python.org/2/library/stdtypes.html#dict.get http://www.tutorialspoint.com/python/dictionary_get.htm

following syntax get() method:

dict.get(key, default=none)

there's nothing on stack, assume it's beginner mistake?

the error message says get takes no keyword arguments providing 1 default=0

converted_comments[submission.id] = converted_comments.get(submission.id, 0) 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -