On Mon, Sep 23, 2013 at 10:22 AM, Edward Kim <onward.ed...@gmail.com> wrote: >> >>> Base = declarative_base() >> >>> Base >> <class 'sqlalchemy.ext.declarative.api.Base'> > > > How this function is return class, not instance? Is it kind of design > pattern? > > I know It is not a big deal for just using SQLAlchemy, but I can't explain > what it is > and how can return the class.
A class is an object like any other. You can pass around references to classes like any other reference, and you can create them just as well: >>> def make_me_a_class(): ... class A(object): ... def f(self): ... print "I'm a class" ... return A ... >>> B = make_me_a_class() >>> c = B() >>> c.f() I'm a class >>> -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/groups/opt_out.