Le mercredi 31 août 2016 14:19:39 UTC+2, daniel.franca a écrit :
>
> But it's okay, isn't it?
> I mean, *add* is used to add the key if the key doesn't exist.
> *set* on the other hand, will set the value anyway.
>
> In the case of *get_or_set *the set should work like an *add *because 
> it'll be called only in case the key doesn't exist.
>
> Or am I missing something?
>

You're right on the expected behaviour. My point is that the function 
should have been named get_or_add since it is self explanatory. Reading the 
name get_or_set, i expect the function to first perform a get and then a 
set if the key is not there.

I'll try to see if i can submit something interesting for the doc.

thanks 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/529136a5-f5c7-48db-b002-3eb678d0857e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to