Code compression

Asked by Charles on 2017-05-06

Hi there.
I have similar big bunches of code in my project in different places. How i can have this block in single place and short links to it(or kind of it) in another places?

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
Milteven
Solved:
2017-05-08
Last query:
2017-05-08
Last reply:
2017-05-07
Best Milteven (milteven12) said : #1

Define the similar codes inside functions and call them when you need to.

Charles (charlesairborne) said : #2

Tnx, this was easier than i expected.

def f():
    'randomcode'

f()

Charles (charlesairborne) said : #3

Thanks Milteven, that solved my question.