[ZODB-Dev] Idiom question

Kent Hoxsey khoxsey@caspiannetworks.com
Fri, 17 Aug 2001 11:23:36 -0700


There's a coding structure that I've seen a few times in some
different parts of Zope, which I ran across again today in DB.py:

	class DB(UndoLogCompatible.UndoLogCompatible):
		# ...snip
		klass = Connection
		# ...more stuff snipped
		def open( self, version='', transaction=None, ...):
			#...snip
			c = self.klass(version, cache_size, etc.)

I'm curious why Connection is aliased to klass, and then called as
self.klass. What is gained over doing it this way:

			c = self.Connection(...)

TIA.

k1

BTW, that's "idiom" not "idiot"... :-P