Abstract attributes in Python

Posted by deamon on Stack Overflow See other posts from Stack Overflow or by deamon
Published on 2010-04-29T09:47:57Z Indexed on 2010/04/29 10:07 UTC
Read the original article Hit count: 225

Filed under:
|
|
|

What is the shortest / most elegant way to implement the following Scala code with an abstract attribute in Python?

abstract class Controller {

    val path: String

}

A subclass of Controller is enforced to define "path" by the Scala compiler. A subclass would look like this:

class MyController extends Controller {

    override val path = "/home"

}

© Stack Overflow or respective owner

Related posts about python

Related posts about oop