On 2 Dec 2003 at 8:43, Brian Kelley wrote:

> Rick King wrote:
> 
> >"""
> >The proper way to get this type of subset is:
> >
> >    subset = view.select(10,19)
> >    indices = view.indices(subset)
> >"""

There is no such form of select.

>>> print v.select.__doc__
select(criteria) -- return virtual view with selected rows
select(crit_lo, crit_hi) -- select rows in specified range (inclusive)
  criteria may be keyword args or dictionary
>>>

The second form requires dictionaries, as Niki said. Mk has to
know what property you're attempting to select on. There's no
exception for single-property views.

-- Gordon
http://www.mcmillan-inc.com/

> I did some more testing and view.select seems horribly broken in this
> regard.  I can only get it to work if the view has one column and
> select(2,4) returns all rows between 0 and 4 (that is the low value
> always appears to be set to 0).  Interestingly, my version of your 
code
> works except for the low bug I just described.
> 
> import metakit
> st = metakit.storage()
> vw = st.getas("test[a:I]")
> for i in range(10):
>     vw.append(a=i)
> 
> metakit.dump(vw)
> a=vw.select(3,6)
> metakit.dump(a)
> 
> 
> I suggest not using it this way given the bugs I've described :)  I'm
> going to put a recommendation in the annotated docs not to use this 
form
> currently.  Although there are some reasons why it would be nice if 
it
> worked.
> 
> i.e.
> subset = vw[0:10]
> indices = vw.indices(subset) -> doesn't work
> 
> >I created a simple view and tried this and got the traceback. All 
the
> >docs (the Metakit docs, the PyShell completion tip) indicate that I
> >should be able to call select like this, although it does seem a bit
> >odd from a Python point of view because it is overloading the select
> >method. I think I don't understand the docs.
> >
> >BTW, your page has been very helpful - I just wish I'd known about 
it
> >sooner!
> >
> They have only existed for a month or so.  I'm always looking for 
> updates and corrections by the way.
> 
> Brian
> 
> _____________________________________________
> Metakit mailing list  -  [EMAIL PROTECTED]
> http://www.equi4.com/mailman/listinfo/metakit


_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to