On Dec 9, 2008, at 4:09 PM, Angri wrote:

> particularly
> explicitly define class properties (inheritable class properties!)

if you'd like to submit a patch which defines __visit_name__ for all  
ClauseElements and removes the logic from VisitableType to guess the  
name, it will be accepted.  The second half of VisitableType still may  
be needed since it improves performance.

> instead of doing things like eval("Annotated%s"  %
> element.__class__.__name__)?

The __name__ based logic is gone.

The code that used to be there, which is the code i was mentioning,  
was this:

   return object.__new__(
                 type.__new__(type, "Annotated%s" %  
element.__class__.__name__, (Annotated, element.__class__), {})
             )

This generates a new type dynamically and is the preferred way to do  
this.  The __name__ is only used there to give the resultling class a  
name and not any kind of lookup semantics.

Unfortunately the resulting class is not pickleable since it is not  
declared in the module.  So there are two options I'm aware of.   
Either do this:


class AnnotatedClauseElement(Annotated, ClauseElement):
    ....

class AnnotatedFromClause(Annotated, FromClause):
   ...

class AnnotatedColumnElement(Annotated, ColumnElement):
   ...

< continue for 100 more classes in sqlalchemy.expression>

Or do the "Exec" thing we have.  A third alternative would be great if  
you have one in mind.



--~--~---------~--~----~------------~-------~--~----~
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