Table of Contents
In Section 8.1 we have learnt how to define functions. In this chapter we introduce new mechanims for parameter definition and passing. We also present a new way to use functions.
Up to now, we have called functions by passing arguments in the order that was specified by the definition of the function:
def isunique(str, motif):
nb = count(str, motif)
if nb != 1:
return False
else:
return True
seq = "..."
BamHI = 'GGATCC'
print isunique(seq, BamHI)
This is called passing arguments by position.
It is also possible to pass arguments by name:
print isunique(str=seq, motif=BamHI)or, since the order is no longer required:
print isunique(motif=BamHI, str=seq)You can mix either style, but named argument must be put after positioned arguments.
print isunique(seq, motif=BamHI)