On Jan 5, 2008 10:55 PM, Aaron Swartz <[EMAIL PROTECTED]> wrote:
>
> > # schema.py
> > from web.schema import Schema, Table, Column, Unique, types, constants
> >
> > blog_table = Table('blog',
> > Column('id', types.integer, primary_key=True),
> > Column('created', types.timestamp, default=constants.utc_now),
>
> This is too wordy. What about:
>
> import web.schema as s
>
> blog_table = s.Table('blog',
> s.Column('id', s.t.integer, primary_key=True)
> s.Column('created', s.t.timestamp, default=s.c.utc_now),
Readability counts.
It is difficult to understand that t is types and c is constants.
> ...
>
> or even just s.utc_now and s.integer?
I thought about it. But it may tempt people to do import *, which is a bad idea.
Not many people use import as.
Problem with using just import is that the user may need to invent a
new name for his schema.
import schema
myschema = scheme.Schema(...)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---