Better newline handling in final SLHA output formatting

Mon, 29 Apr 2013 15:04:31 +0200

author
Andy Buckley <andy@insectnation.org>
date
Mon, 29 Apr 2013 15:04:31 +0200
changeset 214
fa07ed634b18
parent 213
11aef4bd7802
child 215
8a64587e884f

Better newline handling in final SLHA output formatting

pyslha.py file | annotate | diff | comparison | revisions
     1.1 --- a/pyslha.py	Mon Apr 29 14:59:23 2013 +0200
     1.2 +++ b/pyslha.py	Mon Apr 29 15:04:31 2013 +0200
     1.3 @@ -35,14 +35,11 @@
     1.4  
     1.5  TODOs:
     1.6  
     1.7 -  For 2.0.0:
     1.8 +  For 2.1.0:
     1.9     * Preserve comments from read -> write (needs full-line/inline comment
    1.10       separation?). Can use separate comment dicts in Block and Decay, and
    1.11       attach a multiline .comment attr to the returned/written dicts.
    1.12  
    1.13 -  For 2.1.0:
    1.14 -   * Output column alignment cosmetics
    1.15 -
    1.16    Later/maybe:
    1.17     * Identify HERWIG decay matrix element to use in ISAWIG
    1.18     * Handle RPV SUSY in ISAWIG
    1.19 @@ -426,7 +423,8 @@
    1.20  
    1.21  def writeSLHA(blocks, decays, ignorenobr=False, precision=8):
    1.22      """Return an SLHA definition as a string, from the supplied blocks and decays dicts."""
    1.23 -    return writeSLHABlocks(blocks, precision) + "\n\n" + writeSLHADecays(decays, ignorenobr, precision)
    1.24 +    ss = [x for x in (writeSLHABlocks(blocks, precision), writeSLHADecays(decays, ignorenobr, precision)) if x]
    1.25 +    return "\n\n".join(ss)
    1.26  
    1.27  
    1.28  

mercurial