|
|
|
|
|
by makecheck
3643 days ago
|
|
Python has had some surprising costs but some well-known cases have straightforward work-arounds. For example, at one point, the way you called a multi-dot function actually mattered (not sure if this persists in the latest Python releases). If your function is like "os.path.join", the interpreter would seem to incur a cost for each dot: once to look up "os.path" and once to look up "path.join". This meant that there was a noticeable difference between calling it directly several times, and calling it only through a fully resolved value (e.g. say "path_join = os.path.join" and call it only as "path_join" each time). Another good option is to use the standard library’s pure-C alternatives for common purposes (containers, etc.) if they fit your needs. |
|