On 23 Aug 2012, at 8:39 AM, Anthony <abasta...@gmail.com> wrote: > Couple of things (including questions). > > 1. attributes defined in the Field() spec are lazy already, right? > > I guess not so much "lazy", but for the most part all that happens is they > get added as attributes to the Field's self. There is a little logic in the > constructor, though. I suppose we don't really need to make them much more > lazy, but then I'm wondering about the use case for on_define. > > In the above example, the attributes could just as well be defined there; my > intent was for attributes that required more logic, where attributes are > being set conditionally and it's clumsy to construct different Field() calls > to do it. > > OK, sounds reasonable. Do you have an example? >
More later (I'm off to a meeting). Looking at the new code, I see that Massimo and I had different ideas about the definition of on_define. I think they both have merit, and I need to consider the implications. Briefly, the new code patches up the table definition, which will be used as usual in a lazy fashion. My version defined a function to be called when the table was actually created (later, lazily). --