Jump to content

Python: Difference between revisions

312 bytes added ,  24 June 2021
Line 501: Line 501:
* Using <code>json.dump(data, f)</code> will dump without pretty printing
* Using <code>json.dump(data, f)</code> will dump without pretty printing
** Add indent parameter for pretty printing.
** Add indent parameter for pretty printing.
==Type Annotations==
Python 3 supports adding type annotations. However it is not enforced at runtime. 
You can check types ahead of time using [https://google.github.io/pytype/ pytype].
<syntaxhighlight lang="python">
function add_two_values(a: float, b: float) -> float:
    return a + b
</syntaxhighlight>


==Images==
==Images==