On Wed, May 21, 2014 at 3:29 PM, Siegfried Gonzi
<siegfried.go...@ed.ac.uk> wrote:
> Please would anyone tell me the following is an undocumented bug
> otherwise I will lose faith in everything:
>
> ==
> import numpy as np
>
>
> years = [2004,2005,2006,2007]
>
> dates = [20040501,20050601,20060801,20071001]
>
> for x in years:
>
>      print 'year ',x
>
>      xy =  np.array([x*1.0e-4 for x in dates]).astype(np.int)
>
>      print 'year ',x
> ==
>


It seems like a misunderstanding of Python scoping, or just an
oversight in your code, or I'm not understanding your question.  Would
you expect the following code to print the same value twice in each
iteration?

for x in (1, 2, 3):
    print x
    dummy = [x*x for x in (4, 5, 6)]
    print x
    print


> Or is this a recipe to blow up a power plant?

Now we're on the lists...


Cheers!
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to