Hi all,

I have a really short experience of python so it can be really stupid 
question.
I tried to understanding about declarative_base().

Example below:

Base = declarative_base()
>
class Bus(Base):

    __tablename__ = 'bus' 

    ....


In my understanding, That python code look like function or class. So it 
will be
return some value or instance.

In SQLAlchemy, declarative_base() return something and then, Bus class
inherit that Base. I saw the code in SQLAlchemy, But I can't understand what
exactly supposed to be.

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

Please let me know what I need to know about this pattern or style.


Thanks,

Edward.

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to