Conditional comment for ‘Except IE8’?

there’s some JS that I want to load for all browsers EXCEPT IE8, what conditional comment should I use? For something to appear in ‘other browsers’ that don’t support CCs, you need a downlevel-revealed conditional comment. <!–[if !IE 8]><!–> …. <!–<![endif]–> (this is slightly different to Microsoft’s official syntax which is not valid HTML.) “All … Read more

Conditional with statement in Python

Python 3.3 introduced contextlib.ExitStack for just this kind of situation. It gives you a “stack”, to which you add context managers as necessary. In your case, you would do this: from contextlib import ExitStack with ExitStack() as stack: if needs_with(): gs = stack.enter_context(get_stuff()) # do nearly the same large block of stuff, # involving gs … Read more