The
Best New Features of Python 3.8
=> Parallel filesystem cache for compiled bytecode files
The Python 3.8 is the latest version and it used
for scripting and automation to machine learning and web development.
Let’s
explains one-by-one the Python 3.8 new features -
=>
Assignment expressions
if (n :=
len(a)) > 10:
print(f"List is too long ({n}
elements, expected <= 10)")
=>
Positional-only parameters
def pow(x,
y, z=None, /):
r = x**y
if z is not None:
r %= z
return r
=> Parallel filesystem cache for compiled bytecode files
=>
Debug
build uses the same ABI as release build
=>
A
fast calling protocol for CPython
=>
The
subprocess.Popen() can now use os.posix_spawn() in some cases for better
performance
=>
The
statistics.mode() function no longer raises an exception when given multimodal
data
=>
f-strings now support = for quick and easy debugging
x = 3
print(f'{x*9
+ 15=}')
=>
Improved
Modules - ast, asyncio, builtins, collections, ctypes, functools, datetime,
gettext, inspect, idlelib and IDLE, and json.tool
=>
Python
Initialization providing finer control on the whole configuration and better
error reporting.
=>
Python New Structures:
1. PyConfig
2. PyPreConfig
3. PyStatus
4. PyWideStringList
=>
Python New functions:
1. PyConfig_Clear()
2. PyConfig_InitIsolatedConfig()
3. PyConfig_InitPythonConfig()
4. PyConfig_Read()
5. PyConfig_SetArgv()
6. PyConfig_SetBytesArgv()
7. PyConfig_SetBytesString()
8. PyConfig_SetString()
9. PyPreConfig_InitIsolatedConfig()
10. PyPreConfig_InitPythonConfig()
11. PyStatus_Error()
12. PyStatus_Exception()
13. PyStatus_Exit()
14. PyStatus_IsError()
15. PyStatus_IsExit()
16. PyStatus_NoMemory()
17. PyStatus_Ok()
18. PyWideStringList_Append()
19. PyWideStringList_Insert()
20. Py_BytesMain()
21. Py_ExitStatusException()
22. Py_InitializeFromConfig()
23. Py_PreInitialize()
24. Py_PreInitializeFromArgs()
25. Py_PreInitializeFromBytesArgs()
26. Py_RunMain()
=>
The
Py_DEPRECATED() macro has been implemented for MSVC. The macro now must be
placed before the symbol name.
Example:
Py_DEPRECATED(3.8) PyAPI_FUNC(int)
Py_OldFunction(void);
Explore
in detail -
https://docs.python.org/3.8/whatsnew/3.8.html
and
https://www.code-sample.com/2017/12/python-interview-questions-and-answers.html
https://docs.python.org/3.8/whatsnew/3.8.html
and
https://www.code-sample.com/2017/12/python-interview-questions-and-answers.html