[Twisted-Python] Get an object that provides an interface

Gustavo Dagostin da Silva gds11561 at tj.sc.gov.br
Mon Nov 21 14:52:14 EST 2005


Is it possible to get an object that provides (from a class that implements) a 
interface without mentioning the class? In other words:

class ISomething(Interface):
	def method(self):
		""" Do something

class SomethingImplementor:

	def method(self):
		print "I exist!!"

obj = ISomething() 
# and obj gets an instance of "SomethingImplementor", without 
# mentioning it.

The documentation of component usage in twisted only mentions interfaces in 
the context where "Adapters" are needed.


More information about the Twisted-Python mailing list