Re: [Pytables-users] `__iter__` state and `itertools.islice` when
On Tue, Jul 9, 2013 at 1:58 PM, Anthony Scopatz wrote: > > > > On Tue, Jul 9, 2013 at 8:57 AM, Tony Yu wrote: > >> >> >> >> On Tue, Jul 9, 2013 at 12:58 AM, Antonio Valentino < >> antonio.valent...@tiscali.it> wrote: >> >> >> Yes, this is a bug IMO. >>> Thank you for reporting and thank you for the small demonstration script. >>> >>> Can you please file a bug report on github [1]? >>> Please also add info about the PyTables version you used for the test.. >>> >>> >> Thanks for you quick reply. Ticket filed here: >> >> https://github.com/PyTables/PyTables/issues/267 >> > > Thanks Tony, > > I have made my comments on the issue, but the short version is that I > don't think this is a bug, iteration needs a rewrite, and you should use > iterrows(). > > Be Well > Anthony > > PS you should upgrade to 3.0 and use the new API :) > Hey Anthony, Thanks for your thorough response and explanation on the ticket. I closed the ticket, and I'll be using `iterrows` instead of `islice` from now on. I'll have to wait a bit to upgrade to 3.0, but I'm looking forward to getting rid of all the camelCase. Cheers! -Tony > >> >> Best, >> -Tony >> >> > -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users
Re: [Pytables-users] `__iter__` state and `itertools.islice` when
On Tue, Jul 9, 2013 at 8:57 AM, Tony Yu wrote: > > > > On Tue, Jul 9, 2013 at 12:58 AM, Antonio Valentino < > antonio.valent...@tiscali.it> wrote: > > > Yes, this is a bug IMO. >> Thank you for reporting and thank you for the small demonstration script. >> >> Can you please file a bug report on github [1]? >> Please also add info about the PyTables version you used for the test.. >> >> > Thanks for you quick reply. Ticket filed here: > > https://github.com/PyTables/PyTables/issues/267 > Thanks Tony, I have made my comments on the issue, but the short version is that I don't think this is a bug, iteration needs a rewrite, and you should use iterrows(). Be Well Anthony PS you should upgrade to 3.0 and use the new API :) > > Best, > -Tony > > >> >> >> [1] https://github.com/PyTables/PyTables/issues >> >> -- >> Antonio Valentino >> > > > -- > See everything from the browser to the database with AppDynamics > Get end-to-end visibility with application monitoring from AppDynamics > Isolate bottlenecks and diagnose root cause in seconds. > Start your free trial of AppDynamics Pro today! > http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk > ___ > Pytables-users mailing list > Pytables-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pytables-users > > -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users
Re: [Pytables-users] `__iter__` state and `itertools.islice` when
On Tue, Jul 9, 2013 at 12:58 AM, Antonio Valentino < antonio.valent...@tiscali.it> wrote: > Yes, this is a bug IMO. > Thank you for reporting and thank you for the small demonstration script. > > Can you please file a bug report on github [1]? > Please also add info about the PyTables version you used for the test.. > > Thanks for you quick reply. Ticket filed here: https://github.com/PyTables/PyTables/issues/267 Best, -Tony > > > [1] https://github.com/PyTables/PyTables/issues > > -- > Antonio Valentino > -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk___ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users
Re: [Pytables-users] `__iter__` state and `itertools.islice` when
Hi Tony, Il giorno 09/lug/2013, alle ore 06:38, Tony Yu ha scritto: > Hi, > > I ran into a subtle, unexpected issue while using `itertools.islice`. I > wanted to pass slices of an array for processing without actually reading the > entire array, and I wanted that processing function to know nothing about how > I'm taking that slice. To that end, I had a loop that sliced the array using > `itertools.islice` and called the function on each slice. Instead of > returning the slice I specified, `islice` treated the previous end slice as > the starting point to the next slice. > > That description is a bit confusing, but the example below (along with the > attached test data) should illustrate the point. Maybe I'm missing something, > but the only work around that I found was to set a private flag (e.g. > `h5.root.array._init = False`) on each call to `islice` to reset the counter > used in `__iter__`. > > I'm not sure if this is expected behavior or not, but it does differ from how > `islice` works on numpy arrays (as demonstrated in the example below). I used > the google and nothing similar came up, so I thought I'd post here. > > Best, > -Tony > > > # > > import tables > import itertools > import numpy as np > > > h5 = tables.openFile('test.h5') > array = np.arange(100) > for i in range(5): > # Numpy array slice always returns 0..10 > print list(itertools.islice(array, 0, 10)) > # PyTables array slice shifts with each iteration > print list(itertools.islice(h5.root.array, 0, 10)) > h5.close() > -- Yes, this is a bug IMO. Thank you for reporting and thank you for the small demonstration script. Can you please file a bug report on github [1]? Please also add info about the PyTables version you used for the test.. [1] https://github.com/PyTables/PyTables/issues -- Antonio Valentino -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk ___ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users