Hello Brian, BK> You are, of course, free to implement this functionality, python is BK> very dynamic in this regard, but should this throw an exception if the BK> key doesn't exist like a dictionary?
I think it could return an empty list. Dict keys have to be unique, while here actual values from various columns would be accessed 'as if' they were keys, so such an assumption is rather out of place - it would be like assuming that values in fields specified in WHERE condition of SELECT clause have to be unique. Re implementing it: I still have a lot to learn to be able to implement stuff like that.. BK> What if you multiple values that BK> match (0,'joe')? Return a list of dictionaries. BK> If there is one should it return an object and for BK> many should it return a list? Return a list containing that one dictionary - that's Pythonic IMHO. Yeah, 0 matches, an empty list; 1 match - a list containing that dict; n matches - a list with n dicts. Something like that, not necessarily precisely that, could work. BK> You can certainly convert a view into a set of dictionaries, but BK> remember that in the metakit world, the underlying view can change BK> *underneath* you. Ooops. Didn't know that. Yes, that might be a problem. BK> Columns can be removed, rows can be deleted and the BK> row reference will *still* work! >> I'm sure implementing smth like this >> would be a lot of work, though. BK> Ask and ye shall receive. The following is a metakit wrapper that BK> wraps metakit calls. Wow! Hmmm... Say, is some special goldfish working for you maybe? BK> There may be bugs in it so beware. It behaves BK> just like metakit except: BK> import mkwrap BK> st = mkwrap.storage() BK> vw = st.getas(...) vw[0,'a'] ->> retrieves column 'a' at row 0, equivalent to vw[0].a vw.asDict() ->> returns lists of internal dictionaries row.asDict() ->> converts the row to a dictionary. BK> Enjoy I honestly didn't expect that! Great thanks. I'll try it out. -- Best regards, Marcin mailto:[EMAIL PROTECTED] _____________________________________________ Metakit mailing list - [email protected] http://www.equi4.com/mailman/listinfo/metakit
