13 Apr 2011 10:19
Re: Dynamically change __storm_table__ is it possible?
One more great thing I learnt - Thank a lot, will try that soon. class declaration any where, wow ....(Continue reading)On Wed, Apr 13, 2011 at 7:46 AM, Dirley <dirleyrls@...> wrote: > You can dynamically subclass without eval. Like that: > > class A(object): > __storm_table__ = 'a' > def make_subclass(base, storm_table): > class DynamicallyGeneratedSubclass(base): > __storm_table__ = storm_table > return DynamicallyGeneratedSubclass > C = make_subclass(A, 'c') > issubclass(C, A) # True > C.__storm_table__ # 'c' > 2011/4/12 Steve Kieu <msh.computing@...> >> >> Hi, >> >> Thanks for replying, I have thought about subclassing but how to do it >> dynamically. The only one way I can think of is dynamically generate >> python string contains the class definitions and then eval it to >> return the class object. >> >> Where is my python doc for eval-ing string
>> >> Any other way better than this?
On Wed, Apr 13, 2011 at 7:46 AM, Dirley <
RSS Feed