-
Notifications
You must be signed in to change notification settings - Fork 2
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
Generators in charts don't let me iterate more than once #5
Comments
The generator versus list issue in this issue is done for two reasons, though there are perhaps ways around both.
Though now that I'm writing these reasons out, it occurs to me that this all may be adding up to a bit too much support for things that don't exist, since given the current calls I agree that a list comprehension makes more sense... |
I totally get where you're coming from, especially the ideas behind late binding for the purposes of reducing memory footprint and latency. In addition, I may only want the top 10 in a chart, and any other data is unnecessary (but note that I can't slice the generator anyway). [So what we really need are Python closures, so that the Artist object instantiation can be late-bound instead of the list?] Hum, I mostly brought it up to get at what you were thinking, and to advocate for dead-simple repeatability in a user-facing API. |
yes. I suppose the question then is which comprehension is a better approximation of what is desired, as a placeholder until such time as someone (probably me) can write something that looks a lot like closures... |
I was playing with some "how big is an Object" code in python, but calling If you take a policy stand that other entities shall be as minimal as that (and hitting the API is a separate step), I'd place my vote for list comprehension. |
Alright, you've convinced me, until such time I (or some else) gets some proper closures in the charts class we'll change it over to a list comprehension, and to keep core entities small till you do something with them. |
Generator expressions are cool and all, but I think they're out of place in the
Chart.<chart_type>
attribute for a couple reasons.self.response
attribute, which, if it (eventually) followsmmpy.Artist()
's patterns, changes value with each API call.My personal opinion would be to use a simple list comprehension in the place of the generator expression, so that at least the
c.artist
attribute has stable behaviour, but I don't know where y'all are headed with this.The text was updated successfully, but these errors were encountered: