Opened 9 years ago

Closed 9 years ago

#25611 closed Cleanup/optimization (fixed)

Use a common descriptor signature

Reported by: Tim Graham Owned by: nobody
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently we have several different signatures for descriptor methods __get__() and __set__():

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)

This got several +1s on the mailing list.

Change History (3)

comment:1 by Tim Graham, 9 years ago

Has patch: set

comment:2 by Simon Charette, 9 years ago

Triage Stage: AcceptedReady for checkin

comment:3 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 0b5d32fa:

Fixed #25611 -- Standardized descriptor signatures.

Note: See TracTickets for help on using tickets.
Back to Top