Python: Difference between revisions
No edit summary |
|||
Line 300: | Line 300: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== | ==Classes== | ||
===Static and Class methods=== | ===Static and Class methods=== | ||
Line 347: | Line 347: | ||
* <code>len(os.sched_getaffinity(0))</code> returns the number of threads available to the Python process | * <code>len(os.sched_getaffinity(0))</code> returns the number of threads available to the Python process | ||
* Starting in Python 3.5, if <code>max_workers</code> is none, it defaults to 5 times the number of threads on the system. | * Starting in Python 3.5, if <code>max_workers</code> is none, it defaults to 5 times the number of threads on the system. | ||
==Data Structures== | ==Data Structures== | ||
Line 420: | Line 414: | ||
print(k, v) | print(k, v) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Numpy== | |||
===random=== | |||
Legacy code uses functions from <code>np.random.</code>. | |||
New could should initialize a rng using <code>np.random.default_rng()</code>. | |||
==Anaconda== | ==Anaconda== |