Hi all,

We're running some experiments replacing templates by Components
(which support channels based data-binding amongst other niceties) in
Python, i would like to run an opinion survey about two syntaxes
before moving on. Syntax 0 is what seems more "pythonic" but requires
a less strict call signature by cooking *args and **kwargs which adds
a little overhead, but in in my opinion more readable:



        if not request.user.is_authenticated:
            content.append(
                Li(
                    A(_('Log in'), href=reverse('crudlfap:login')),
                    cls='no-padding',
                )
            )
        else:
            content.append(Li(A(
                _('Log out'),
                **{
                    'class': 'waves-effect',
                    'data-noprefetch': 'true',
                    'href': reverse('crudlfap:logout'),
                }
            ), cls='no-padding'))

The other syntax works with a strict constructor signature, adding no
overhead and less complex but in my opinion less readable and
enjoyable:

        content = [Ul([
            Li([
                A(
                    router_link_content,
                    {'class': 'collapsible-header waves-effect waves-teal'},
                ),
                Div(
                    sublinks,
                    {'class': 'collapsible-body'}
                )
            ], {
            'class': self.active
            })
        ], {
            'class': 'collapsible collapsible-accordion'
        })]

If you were in the position where you had to decide what syntax to
keep before moving on, how would you decide ?

Thanks in advance for your feedback

More context:
https://yourlabs.io/oss/crudlfap/commit/85cccdfef936d4303c1abde39238b7dbd688eee1
https://yourlabs.io/oss/ryzom/tree/ssr

-- 
∞

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAC6Op18HQyX0TiY9u1%3DtxsPFTE9E4GG9LsbVw6j2cvfwXXXObw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to