Top "Magic-methods" questions

Magic methods are implicitly invoked by a programming language when some event or language construct is used.

How does Scala's apply() method magic work?

In Scala, if I define a method called apply in a class or a top-level object, that method will be …

scala syntactic-sugar magic-methods companion-object
Why does Python use 'magic methods'?

I've been playing around with Python recently, and one thing I'm finding a bit odd is the extensive use of …

python magic-methods
Use of PHP Magic Methods __sleep and __wakeup

What is the use of the __sleep and __wakeup magic methods in PHP? I read the PHP documentation but it's …

php oop magic-methods
PHP 5.3 Magic Method __invoke

This topic expands on When do/should I use __construct(), __get(), __set(), and __call() in PHP? which talks about the __…

php oop magic-methods
Where is the Python documentation for the special methods? (__init__, __new__, __len__, ...)

Where is a complete list of the special double-underscore/dunder methods that can be used in classes? (e.g., __init__, __…

python class oop documentation magic-methods
PHP Arrayable Interface

I'm sure I read a while back about a new feature of PHP that was either a new magic method …

php arrays interface casting magic-methods
Python __index__ special method

>>> class Thing(object): ... def __index__(self): ... return 1 ... >>> thing = Thing() >>> list_ = ['abc', …

python magic-methods
How to overload Python's __bool__ method?

Possible Duplicate: defining “boolness” of a class in python I thought this should print "False", why is it printing "True"? &…

python methods overloading magic-methods
Magic Methods in JavaScript

Long story short: I'm in a situation where I'd like a PHP-style getter, but in JavaScript. My JavaScript is running …

php javascript magic-methods
scala slick method I can not understand so far

I try to understand some Slick works and what it requires. Here it an example: package models case class Bar(…

scala playframework-2.0 magic-methods scalaquery slick