Skip to content
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

utils/data: Use list comprehension for uniq_stable() #2849

Merged
merged 1 commit into from Jan 26, 2013

Conversation

wking
Copy link
Contributor

@wking wking commented Jan 25, 2013

This should be faster than and explicit for loop. Also, a set makes more
sense than a dict if we only care about values. After these changes, the
resulting code is the same as Dave Kirby's uniqify() suggestion on Peter
Bengtsson's blog 1.

@jasongrout
Copy link
Member

The documentation to the function probably ought to be changed too...

@wking
Copy link
Contributor Author

wking commented Jan 25, 2013

On Fri, Jan 25, 2013 at 09:57:24AM -0800, Jason Grout wrote:

The documentation to the function probably ought to be changed too...

Thanks. Fix pushed.

This also lifts the “valid dictionary keys” (i.e. immutable)
restriction.

@wking
Copy link
Contributor Author

wking commented Jan 25, 2013

On Fri, Jan 25, 2013 at 01:38:25PM -0500, W. Trevor King wrote:

This also lifts the “valid dictionary keys” (i.e. immutable)
restriction.

Oops, no it doesn't ;)

This should be faster than and explicit for loop.  Also, a set makes
more sense than a dict if we only care about values.  After these
changes, the resulting code is the same as Dave Kirby's uniqify()
suggestion on Peter Bengtsson's blog [1].

[1]: http://www.peterbe.com/plog/uniqifiers-benchmark
@minrk
Copy link
Member

minrk commented Jan 26, 2013

sensible, merging.

minrk added a commit that referenced this pull request Jan 26, 2013
utils/data: Use list comprehension for uniq_stable()

This should be faster than and explicit for loop.  Also, a set makes more
sense than a dict if we only care about values.  After these changes, the
resulting code is the same as Dave Kirby's uniqify() suggestion on Peter
Bengtsson's blog [1].

[1]: http://www.peterbe.com/plog/uniqifiers-benchmark
@minrk minrk merged commit 512eaf5 into ipython:master Jan 26, 2013
minrk added a commit that referenced this pull request Mar 5, 2013
This should be faster than and explicit for loop.  Also, a set makes more
sense than a dict if we only care about values.  After these changes, the
resulting code is the same as Dave Kirby's uniqify() suggestion on Peter
Bengtsson's blog [1].

[1]: http://www.peterbe.com/plog/uniqifiers-benchmark
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
utils/data: Use list comprehension for uniq_stable()

This should be faster than and explicit for loop.  Also, a set makes more
sense than a dict if we only care about values.  After these changes, the
resulting code is the same as Dave Kirby's uniqify() suggestion on Peter
Bengtsson's blog [1].

[1]: http://www.peterbe.com/plog/uniqifiers-benchmark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants