First, the second factor of isinstance() can be tuple-type
assert isinstance(lst, list) or isinstance(lst, tuple)
can be reduced to assert is instance(lst, (list, tuple))
.
And when you use the ASSERT, I think
assert not isinstance(lst, basestring)
I think it's a better way to use it
(Please change to string
since Python 3 cannot use basestring
)
If you write it like the way you asked,
Although it is not subclass
in list
/tuple
, assertionError
occurs in other types that behave like list
/tuple
.
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.