Why does the flush keyword not work with print()?
Posted: Fri Feb 12, 2021 10:09 pm
I am printing a string immediately before going into lightsleep, but the string doesn't complete until the sleep command is complete. The "flush" keyword on the print command should alleviate this, but it doesn't seem to work.
produces
yet, the definition of print shows that flush is a valid keyword:
Code: Select all
print('x', flush=True)
Code: Select all
File "<stdin>", line 1, in <module>
TypeError: extra keyword arguments given
Code: Select all
def print(
*values: object, sep: Optional[Text] = ..., end: Optional[Text] = ..., file: Optional[_Writer] = ..., flush: bool = ...
) -> None: ...