Top "Class-method" questions

Methods that are called on a class instead of on an object.

Ruby: Can I use instance methods inside a class method?

I have a class that contains this class method: def self.get_event_record(row, participant) event = Event.where( :participant_…

ruby-on-rails ruby class-method instance-methods
Is it bad form to call a classmethod as a method from an instance?

Ex. If I have something like this: class C(object): @classmethod def f(cls, x): return x + x This will …

python class-method
What's the difference between "class method" and "static method"?

I've worked with a few different languages such as Java, C#, and Objective-C. In most languages, methods that don't require …

objective-c terminology static-methods class-method
Factory method for objects - best practice?

This is a question regarding the best practice for creating an instance of a class or type from different forms …

python coding-style decorator class-method factory-method
Why always add self as first argument to class methods?

Possible Duplicate: Why do you need explicitly have the “self” argument into a Python method? I understand why self is …

python class methods class-method
How do I list all objects created from a class in Ruby?

Is there any way in Ruby for a class to know how many instances of it exist and can it …

ruby oop class-method
Python: How to call an instance method from a class method of the same class

I have a class as follows: class MyClass(object): int = None def __init__(self, *args, **kwargs): for k, v in …

python oop python-2.7 class-method
Attaching a decorator to all functions within a class

I don't really need to do this, but was just wondering, is there a way to bind a decorator to …

python class oop decorator class-method
getattr on class objects

class A: def foo(self): print "foo()" getattr(A, foo) # True A.foo() # error getattr(A(), foo) # True A().foo() # …

python class-method getattr
How do I call +class methods in Objective C without referencing the class?

I have a series of "policy" objects which I thought would be convenient to implement as class methods on a …

objective-c metaprogramming class-method