Skip to content

Perlnd and Implnd Class's get_*() methods return unnamed tuples.  #11

@lucashtnguyen

Description

@lucashtnguyen

For example, Perlnd line 276:

    def get_pwat_parm1(self):
        """Returns the PWAT-PARM1 flags as a tuple."""

        return (self.operation,     self.CSNO, self.RTOP, self.UZFG, self.VCS, 
                self.VUZ, self.VNN, self.VIFW, self.VIRC, self.VLE, self.IFFC, 
                self.HWT, self.IRRG)

We could use a namedtuple to return a more useful result like:

    from collections import namedtuple
    ...
    def get_pwat_parm1(self):
        """Returns the PWAT-PARM1 flags as a tuple."""
        pwat_parm1 = namedtuple(
            'pwat_parm1',
            [
                'operation', 'CSNO',
                'RTOP', 'UZFG',
                'VCS', 'VUZ',
                'VNN', 'VIFW',
                'VIRC', 'VLE',
                'IFFC', 'HWT',
                'IRRG'
            ]
        )

        res = pwat_parm1(
            operation = self.operation,
            CSNO = self.CSNO,
            RTOP = self.RTOP,
            UZFG = self.UZFG,
            VCS = self.VCS,
            VUZ = self.VUZ,
            VNN = self.VNN,
            VIFW = self.VIFW,
            VIRC = self.VIRC,
            VLE = self.VLE,
            IFFC = self.IFFC,
            HWT = self.HWT,
            IRRG = self.IRRG
        )
        return res

which would return something like pwat_parm1(operation=1, CSNO=1, RTOP=1, UZFG=1, VCS=1, VUZ=1, VNN=1, VIFW=1, VIRC=1, VLE=1, IFFC=1, HWT=1, IRRG=1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions