On Wed, 2007-07-02 at 11:53 +0200, svilen wrote:
> > If you have the time and know how, do you know what the efficient
> > way to iterate through all the class definitions in a module would
> > be to grab all the classes that have a certain member?
> 
> import module
> for k,v in module.__dict__.iteritems()
>   if isinstance(v,type):
>     if issubclass(v, somebase):       #i would advice this, it's up to u
>       if hasattr( v, yourmember):
>               ....            
> 

Thanks! I didn't know how to use iteritems that way
> btw. u should read the sources _more_, reading the docs aside.
> What's the point of using interpreted language _and_ open-source  
> otherwise?

yes I'm sure you're right. But the SA sources right now look a ways over
my head!

Anyway, thanks so much for the tips.

Iain



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to