Can the Python language assign values in judgment statements?

I used to do CPP and Java, but I just came into contact with Python. In Java and CPP, in order to reduce the number of function calls, it is convenient to assign values directly to the judgment conditions of while or if statements. But in Python the following code reported an error, would you like to ask Python does not allow this way?

class Fib(object):
    def call(self, num):
        L = []
        while (length = len(L))<num:
            if length==0:
                L.append(0)
            elif length==1:
                L.append(1)
            else:
                L.append(L[-1]+L[-2])
        return L

f = Fib()
print f(10)

the while statement judgment condition of the above code where the error is reported

Apr.25,2021

python3.7 is a
that can be assigned in a conditional statement. Versions of python before

cannot be

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea7500-47c1b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea7500-47c1b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?