Variable class instantiation
Sion Arrowsmith
sion at viridian.paintbox
Fri Dec 11 06:36:13 EST 2009
Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:
>thisModule = __import__(__name__)
>classToUse = thisModule.__dict__['C1']
Any reason to prefer this over:
classToUse = getattr(thisModule, 'C1')
? (I think, for a module, they should do exactly the same thing.
Personally, I prefer keeping explicit references to __special
names__ to a minimum.)
--
\S
under construction
More information about the Python-list
mailing list