Now that Curtis did all the investigation work I think it wouldn't hurt 
being consistent here.

__get__(self, instance, cls=None) and __set__(self, instance, value) look 
like sane defaults to me.

Le samedi 24 octobre 2015 18:36:32 UTC-4, Tim Graham a écrit :
>
> Curtis, or should I say FunkyBob, raised the issue here: 
> https://github.com/django/django/pull/5226
>
> Currently we have several different signatures:
>
> def __get__(self, instance, instance_type=None)
> def __get__(self, obj, type=None):
> def __get__(self, instance, type=None)
> def __get__(self, obj, objtype)
> def __get__(self, instance, owner)
>
> and the Python docs don't seem to have a single preference.
>
> Curtis proposed:
> """
> * "instance_type" is explicit
> * "cls" is a common convention for passing a class
> * "owner" is in the docs {but so are others}
> * and "type" I think is a bit confusing... 
>
> So... my preference, upon reflection, would be: def __get__(self, 
> instance, cls=None):
> """
>
> For set, it's mostly: def __set__(self, instance, value)
> but a couple times: def __set__(self, obj, value)
>
> Do you think it's worth trying to be consistent or not?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/39cb93c3-a6e5-4deb-b34f-95bd844a764e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to