-
Notifications
You must be signed in to change notification settings - Fork 0
/
4r87abqmoc.html
1 lines (1 loc) · 1.27 KB
/
4r87abqmoc.html
1
<div></div><div>To import all numpy modules at once instead of one at a type as needed, type <code>from numpy import *</code>. The <code>import *</code> command is dangerously convenient — we will sometimes use it ourselves, being not as pure in thought as others might be on this issue— but take two considerations in mind: (1) you are importing code you don't need in addition to that you do, and (2) if you have any already defined functions that have the same name as a numpy function, those functions will be overwritten. This is particularly prone to happen with mathematical functions. For example, the math package <code>math</code>, the complex mathematics package <code>cmath</code>, the numerical python package <code>numpy</code>, and the numerical calculation of uncertainties package <code>uncertainties</code> all have trigonometric functions called <code>sin</code> and <code>cos</code>! If you only need the sine and cosine functions from the numerical python package numpy but , typing from numpy import sin, cos </div><div></div><div>The <u>second method</u> requires a prefix before each use of a module. We call this the <b>traditional numpy import style</b>. </div>