Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You could also say that's 4 comparisons vs. 2 comparisons. Not the end of the world, but what if you have one additional level of nesting?

    if a:
      if b:
        if c:
        if d:
      if e:
        if f:
        if g:
Vs.

    if a and b and c:
    if a and b and d:
    if a and e and f:
    if a and e and g:
Or would you perhaps find

    if a and b and c:
    if d and b and a:
    if e and a and f:
    if g and e and a:
Or

    if e and f and a:
    if c and b and a:
    if g and a and e:
    if d and a and b:
In any case, now you have 12 comparisons vs. 3 comparisons. (Though this is not entirely comparable to CSS, since selector order is somewhat more restricted.)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: