Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20456

Re: how to tell a method is classmethod or static method or instance method

References <mailman.5754.1329116374.27778.python-list@python.org> <4f38c3cc$0$11112$c3e8da3@news.astraweb.com>
Date 2012-02-15 13:31 -0500
Subject Re: how to tell a method is classmethod or static method or instance method
From Nathan Rice <nathan.alexander.rice@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5840.1329330708.27778.python-list@python.org> (permalink)

Show all headers | View raw


> And I'll take this opportunity to plug my dualmethod descriptor:
>
> http://code.activestate.com/recipes/577030-dualmethod-descriptor/

I use an analogous pattern in SQL Alchemy all the time (it's called
hybridmethod/hybridproperty there).

+1 to dualmethod, that pattern is great when you want a method or
property that does something concrete when passed an instance, or
something abstract relating to all instances when passed a class.


Nathan

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

how to tell a method is classmethod or static method or instance method Zheng Li <dllizheng@gmail.com> - 2012-02-13 15:59 +0900
  Re: how to tell a method is classmethod or static method or instance method Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-13 08:03 +0000
    Re: how to tell a method is classmethod or static method or instance method 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-13 01:01 -0800
    Re: how to tell a method is classmethod or static method or instance method Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-15 13:31 -0500

csiph-web