Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need developer-friendly way to defer unit assignment #14

Open
guruofgentoo opened this issue Jun 21, 2016 · 1 comment
Open

need developer-friendly way to defer unit assignment #14

guruofgentoo opened this issue Jun 21, 2016 · 1 comment

Comments

@guruofgentoo
Copy link
Member

If a Column or Row is declared, the unit is immediately added to the section's internal cls_units. Sometimes this may not be desired. Passing _dont_assign in the declaration is effective to prevent assignment, but there is no good way to complete the assignment later on.

@3noch
Copy link
Contributor

3noch commented Jun 21, 2016

One solution would be to offer an alternative method of building sheets. Instead of using a metaclass and hijacking Python's class syntax, we could offer a function/method-based alternative. The difference would be similar to SQLAlchemy declarative vs. SQLAlchemy core (which is, ironically, also declarative).

Remember that "declarative" simply means that we are describing the solution statelessly. You can achieve that to great effect without resorting to metaclasses, and it makes abstraction much easier.

Example:

common_rows = [
   PortraitRow(...),
   PortraitRow(...),
]

sheet = PortraitSheet(
    name='test',
    rows=[
        PortraitRow(...),
    ] + common_rows 
) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants