Re: inherit without calling parent class constructor?

Discussion in 'Python' started by Christian Dieterich, Jan 26, 2005.

  1. On Dé Céadaoin, Ean 26, 2005, at 13:45 America/Chicago, Steven Bethard
    wrote:

    > Note that:
    > @deco
    > def func(...):
    > ...
    > is basically just syntactic sugar for:
    > def func(...):
    > ...
    > func = deco(func)


    Oh, I learned something new today :) Nice thing to know, these
    descriptors.

    > Note that b.size and d.size are only calculated once each, and if
    > d.size is never accessed, you'll never incur the costs of calculating
    > it.


    That's exactly what I need. It works fine for Python 2.2 and 2.3. So,
    I'll try to implement that into my package.

    Thanks a bunch for your help,

    Christian
     
    Christian Dieterich, Jan 26, 2005
    #1
    1. Advertising

  2. Christian Dieterich wrote:
    > On Dé Céadaoin, Ean 26, 2005, at 13:45 America/Chicago, Steven Bethard
    > wrote:
    >
    >> Note that:
    >> @deco
    >> def func(...):
    >> ...
    >> is basically just syntactic sugar for:
    >> def func(...):
    >> ...
    >> func = deco(func)

    >
    >
    > Oh, I learned something new today :) Nice thing to know, these
    > descriptors.


    Just a note of clarification:

    The @deco syntax is called *decorator* syntax.
    Classes with a __get__ method are called *descriptors*.

    But yes, they're both nice things to know. ;)

    Steve
     
    Steven Bethard, Jan 26, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. pantalaimon
    Replies:
    3
    Views:
    51,080
    John Harrison
    Oct 9, 2004
  2. Christian Dieterich

    inherit without calling parent class constructor?

    Christian Dieterich, Jan 26, 2005, in forum: Python
    Replies:
    3
    Views:
    404
    Jeff Shannon
    Jan 26, 2005
  3. Christian Dieterich
    Replies:
    1
    Views:
    385
    Steven Bethard
    Jan 26, 2005
  4. ali
    Replies:
    4
    Views:
    581
    David Harmon
    Mar 5, 2007
  5. Generic Usenet Account
    Replies:
    10
    Views:
    2,249
Loading...

Share This Page