Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106427

how to optimize the below code with a helper function

From Ganesh Pal <ganesh1pal@gmail.com>
Newsgroups comp.lang.python
Subject how to optimize the below code with a helper function
Date 2016-04-04 13:34 +0530
Message-ID <mailman.5.1459757101.32530.python-list@python.org> (permalink)
References <CACT3xuUQc9wFPqG1DHM0ecwKE2J8KiFKFDui=FvWBqccAGLEoA@mail.gmail.com>

Show all headers | View raw


Hi Team,

Iam on python 2.7.10 and Linux.

I have a  python function where the similar kind of pattern repeating 100
of times

Sample code snippet:

test01_log = os.path.join(LOG_DIR, "test01.log")
        cls.get_baddr['test01'] = failure.run_tool(
            test01_log, object="inode", offset="18", size="4",
            optype="set")

test02_log = os.path.join(LOG_DIR, "test02.log")
        cls.get_baddr['test02'] = failure.run_tool(
            test02_log, lin=lin_02, object="lin", offset="100", size="5",
            optype="set")
 ..............................................------------------------

test100_log = os.path.join(LOG_DIR, "test100.log")
        cls.get_baddr['test100'] = failure.run_tool(
            test02_log, baddr=lin_02, object="baddr", offset="100", size="5",
            optype="set")


(1)  Any tips how I can optimize this i.e test case, should have a helper
function that all test cases call.

(2) Also note that failure.run_tool function can have variable number of
argments  how to handle this in the helper function?



Thanks in advance


Regards,

Ganesh

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

how to optimize the below code with a helper function Ganesh Pal <ganesh1pal@gmail.com> - 2016-04-04 13:34 +0530

csiph-web