[rhinstaller/blivet/pulls/268 master] Add a class constructor for namedtuples with default values

jkonecny12 installerbot-noreply at redhat.com
Wed Nov 4 09:26:46 UTC 2015


> @@ -805,3 +806,43 @@ def the_func(*args, **kwargs):
>          return the_func
>  
>      return deprecate_func
> +
> +def default_namedtuple(name, fields, doc=""):
> +    """Create a namedtuple class
> +
> +    The difference between a namedtuple class and this class is that default
> +    values may be specified for fields and fields with missing values on
> +    initialization being initialized to None.
> +
> +    :param str name: name of the new class
> +    :param fields: field descriptions - an iterable of either "name" or ("name", default_value)
> +    :type fields: list of str or (str, object) objects
> +    :param str doc: the docstring for the new class (should at least describe the meanings and
> +                    types of fields)
> +

Please add return to documentation string ideally with type of return.

-- 
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/268#discussion_r43857732


More information about the anaconda-patches mailing list