The function eval takes a single line of code as string,
evaluates it,
and returns the value.
Notice that objects in the evaluated expression
must be present in the current scope,
otherwise,
exceptions will be thrown.
Even though eval (together with exec) might be useful in some situations,
e.g., when implementing a REPL.
It is strongly suggested that you avoid using eval
Concurrency and Parallel Computing in Python
The GIL is controversial because it prevents multithreaded CPython programs from taking full advantage of multiprocessor systems in certain situations. Note that potentially blocking or long-running operations, such as I/O, image processing, and NumPy number crunching, happen outside the GIL. Therefore it is only in multithreaded programs that spend …
Relative Import in Python
** Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement! **
-
Call the package outside it
-
Add
..intosys.path.:::python import sys sys.path.append("..")
References
Boolean Values in C++
-
Boolean expressions are evaluated from left to right (the same in Java), so it is totally OK to write code like
if(a < x.size() && x[a]){ ... }where
xis a vector. -
There is no
&&=and||=operators in C++, instead you can use&=and|=. Though&=and|=are not specially for …
Deleting Docker Image Tags on DockerHub using the Python Module requests
Tips¶
- You can use Convert curl syntax to Python, Node.js, PHP, R or curlconverter to convert CURL commands to Python requests code.
Get All Tags of a Docker Image¶
Parallel Computing Using Multithreading
-
Not all jobs are suitable for parallel computing. The more comminication that threads has to make, the more dependent the jobs are and the less efficient the parallel computing is.
-
Generally speaking, commercial softwares (Mathematica, MATLAB and Revolution R, etc.) have very good support on parallel computing.
Python
Please refer …