Adding a dict arg (compatible with dict.update) to the Block constructor.

Sun, 28 Apr 2013 22:15:24 +0200

author
Andy Buckley <andy@insectnation.org>
date
Sun, 28 Apr 2013 22:15:24 +0200
changeset 204
bef82eaef56e
parent 203
ce90a0dace07
child 205
536967068fe2

Adding a dict arg (compatible with dict.update) to the Block constructor.

ChangeLog file | annotate | diff | comparison | revisions
pyslha.py file | annotate | diff | comparison | revisions
     1.1 --- a/ChangeLog	Sun Apr 28 22:13:19 2013 +0200
     1.2 +++ b/ChangeLog	Sun Apr 28 22:15:24 2013 +0200
     1.3 @@ -1,5 +1,8 @@
     1.4  2013-04-28  Andy Buckley  <andy.buckley@cern.ch>
     1.5  
     1.6 +	* Adding a dict arg (compatible with dict.update) to the Block
     1.7 +	constructor.
     1.8 +
     1.9  	* Adding Block.set_value(*args) and Block documentation.
    1.10  
    1.11  	* Various fixes to ISAWIG output (and conversion to use new
     2.1 --- a/pyslha.py	Sun Apr 28 22:13:19 2013 +0200
     2.2 +++ b/pyslha.py	Sun Apr 28 22:15:24 2013 +0200
     2.3 @@ -20,7 +20,6 @@
     2.4  TODOs:
     2.5  
     2.6  For 2.0.0:
     2.7 - * Provide a Block constructor that takes a dict of entries
     2.8   * Output column alignment cosmetics
     2.9   * Precision setting obedience in SLHA output of values
    2.10  
    2.11 @@ -113,9 +112,11 @@
    2.12      method may be used to set it if only one argument is supplied and the object
    2.13      is compatible.
    2.14      """
    2.15 -    def __init__(self, name, q=None):
    2.16 +    def __init__(self, name, q=None, entries=None):
    2.17          self.name = name
    2.18          self.entries = _mkdict()
    2.19 +        if entries is not None:
    2.20 +            self.entries.update(entries)
    2.21          self.q = _autotype(q)
    2.22  
    2.23      def add_entry(self, entry):

mercurial