-
Notifications
You must be signed in to change notification settings - Fork 91
changed RelatinalOperand.__iter__ and made settings.Config a singleton
#62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The regular fetch returns numpy records. Why should the iterator yield tuples instead. Let's make it return numpy arrays with typed attributes. |
|
I would have preferred it otherwise, but I don't make the main design decisions. Therefore, I changed it. Here is why I would have preferred it otherwise: I don't like record arrays. While they are awkward to construct and deal with, I think they provide very little benefit. I thought it would have been the cleaner solution for I couldn't find a way to just create a single line of the above array. This means that the iteration now constructs a record array from a tuple, takes its first element, returns an np.void, only to be converted into a tuple again. This does not seem efficient/clean to me. Maybe it has advantages for restrictions or similar operations. But then, I don't see when you'd want to restrict with a full row of a table. Does now became What do we gain? We can use To me that looks just like emulating Matlab while Python can offer cleaner constructs for that. If we want the 'row.animal_id' behaviour, we could have just used |
|
Looking at the current implementation, I agree with @fabiansinz that returning record array seems to be making the code rather dirty and convoluted, yet it is unclear what we are gaining from this... |
|
The result of the iteration needs to preserve the attribute names. So at On Sun, May 10, 2015 at 11:37 AM, Edgar Y. Walker notifications@github.com
|
|
What do we need that for? For restrictions? dicts potentially shuffle the order. OrderedDict would be better. However, both are awkward to stack together into a record array in You can use it like |
|
exactly On Sun, May 10, 2015 at 1:28 PM, Fabian Sinz notifications@github.com
|
Change of
RelatinalOperand.__iter__:RelatinalOperand.__iter__now returns an iterator that yields the single tuples of the table as tuplesmytable.project()RelatinalOperand.fetchnow uses__iter__Settings:
settings.Configis a singleton since there should be one set of global settings.