Skip to main content

Diigo Home

How-To Guide for Descriptors - The Diigo Meta page

users.rcn.com/...Descriptor.htm - Cached

This link has been bookmarked by 24 people . It was first bookmarked on 04 Aug 2006, by Kazuo Moriwaka.

  • 12 Nov 09
  • 06 Nov 09
    • Since staticmethods return the underlying function with no changes, the example
      calls are unexciting:


      >>> class E(object):
      def f(x):
      print x
      f = staticmethod(f)

      >>> print E.f(3)
      3
      >>> print E().f(3)
      3
    • Unlike static methods, class methods prepend the class reference to the
      argument list before calling the function. This format is the same
      for whether the caller is an object or a class:


      >>> class E(object):
      def f(klass, x):
      return klass.__name__, x
      f = classmethod(f)

      >>> print E.f(3)
      ('E', 3)
      >>> print E().f(3)
      ('E', 3)
  • 08 Aug 09
    mertnuhoglu
    Mert Nuhoglu

    çok kaliteli bir makale.

    python metaprogramming

    • RevealAccess
    • If any of those methods are
      defined for an object, it is said to be a descriptor.
    • 26 more annotations...
  • 20 May 09
  • 27 Feb 09
    • __get__, __set__, and __delete__. If any of those methods are
      defined for an object, it is said to be a descriptor.
    • The default behavior for attribute access is to get, set, or delete the
      attribute from an object's dictionary
    • 7 more annotations...
  • 15 Oct 08
  • 13 Sep 08
  • 11 Sep 08
  • 12 Aug 08
    • a descriptor is an object attribute with "binding behavior", one whose
      attribute access has been overridden by methods in the descriptor protocol.
    • descriptors are invoked by the __getattribute__ method
    • 4 more annotations...
  • 01 Apr 08
    • __get__, __set__, and __delete__. If any of those methods are
      defined for an object, it is said to be a descriptor.
    • descriptors are only invoked
      for new style objects or classes
    • 7 more annotations...
  • 02 Jan 08
  • 01 Jun 07
  • 24 Sep 06
  • 04 Aug 06
  • 26 Jan 05