跳到功能

时间:2016-12-27 01:29:00

标签: python function

我的功能有问题。我想知道是否有可能在调用函数第二次程序跳转到该行代码时,就像在汇编程序中我将使用jmp指令。因此,当我首先调用decision_function之后,一些calc_funcs完成(它们无关紧要),但是当我第二次调用相同的决策函数时,我没有执行calc函数。

def main():

    decision_function()
    calc_function1()
    calc_function2()
    calc_function3()
    decision_function(reqierment)

def decision_function(reqierment=None):

    if reqierment is None:
        do this

    else:
        do that

1 个答案:

答案 0 :(得分:-2)

我更喜欢将变量设置为true:

public function encrypt($value)
{
    $iv = random_bytes(16);
    $value = \openssl_encrypt(serialize($value), $this->cipher, $this->key, 0, $iv);
    if ($value === false) {
        throw new EncryptException('Could not encrypt the data.');
    }
    // Once we have the encrypted value we will go ahead base64_encode the input
    // vector and create the MAC for the encrypted value so we can verify its
    // authenticity. Then, we'll JSON encode the data in a "payload" array.
    $mac = $this->hash($iv = base64_encode($iv), $value);
    $json = json_encode(compact('iv', 'value', 'mac'));
    if (! is_string($json)) {
        throw new EncryptException('Could not encrypt the data.');
    }
    return base64_encode($json);
}