r/Python • • Jan 05 '18

Really??

Post image
2.0k Upvotes

317 comments sorted by

View all comments

Show parent comments

1

u/anvils-reloaded Jan 05 '18

If I know what the keys are, I don't really want to load them one at a time, right? This is for situations where I have a specific sized table that I want to use for counting. (I was originally going to use a list but decided that they're not really designed for lookup like dictionaries are). I don't consider it premature optimization because I'm not really optimizing anything, just applying what I know about the problem.

3

u/z0mbietime Jan 06 '18

example = {x: None for x in y}

But based on what you’re describing a collection makes more sense. That being said they’re all right that this is sweating the small stuff. For one, using Python and getting the count when querying the database is going to be faster than anything Java can do.

1

u/Smallpaul Jan 06 '18

I think it's confusing to bring a database into the conversation. Did he say that the data comes from a database?

1

u/z0mbietime Jan 06 '18

I saw table and was running on almost no sleep