Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98829

Re: What is the right way to import a package?

From Christian Gollwitzer <auriocus@gmx.de>
Newsgroups comp.lang.python
Subject Re: What is the right way to import a package?
Date 2015-11-14 22:59 +0100
Organization A noiseless patient Spider
Message-ID <n28an5$2f8$1@dont-email.me> (permalink)
References <8e325d88-6ad1-46e3-a1fb-ef8c28dc50a8@googlegroups.com>

Show all headers | View raw


Am 14.11.15 um 21:00 schrieb fl:
> from numpy import *
> dt = 0.1
> # Initialization of state matrices
> X = array([[0.0], [0.0], [0.1], [0.1]])
>
> # Measurement matrices
> Y = array([[X[0,0] + abs(randn(1)[0])], [X[1,0] + abs(randn(1)[0])]])
>
> When the above content is inside a .py document and running, there will be
>   an error:
>
> ---> 15 Y = array([[X[0,0] + abs(randn(1)[0])], [X[1,0] + abs(randn(1)[0])]])
>       16 #Y = ([[X[0,0]], [X[1,0] + 0]])
>
> NameError: name 'randn' is not defined
>
> But when I run the above line by line at the console (Canopy), there will be
> no error for the above line.

Maybe Canopy is doing a

	from pylab import *

for you?

	Christian

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

What is the right way to import a package? fl <rxjwg98@gmail.com> - 2015-11-14 12:00 -0800
  Re: What is the right way to import a package? Christian Gollwitzer <auriocus@gmx.de> - 2015-11-14 22:59 +0100
  Re: What is the right way to import a package? Grobu <snailcoder@retrosite.invalid> - 2015-11-16 12:53 +0100

csiph-web