Skip to content

Attempt to sort a list by blindly executing code from StackOverflow. Inspired by XKCD Ineffective Sorts.

License

Notifications You must be signed in to change notification settings

buckley-w-david/stacksort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stacksort

Inspired by the famous XKCD comic Ineffective Sorts.

StackSort connects to StackOverflow, searches for 'sort a list', and downloads and runs code snippets until the list is sorted.

Go look at StackRunner, it's the better version of this.

Disclaimer

Please do not actually run this. It has even less safety features than the JavaScript version.

Usage

Taking this idea an running with it, stacksort lets you fetch unsafe, unvetted, arbitrary code from StackOverflow and blindly execute it like you would any other python package!

>>> from stacksort import bubblesort
>>> l = [6, 9, 3, 1, 5, 4, 7, 8, 2]
>>> bubblesort(l)
# Who knows what happens here! It'll try to find a bubblesort implementation and run it

stacksort will search StackOverflow for python snippets, and use whatever you tried to import as part of the search criteria!

Try it Out!

You can try it out yourself in your browser using Binder and opening the playground.ipynb file.

Binder

>>> from stacksort import config
>>> import logging
>>> logging.basicConfig(level=logging.DEBUG)
>>> config.logger.setLevel(logging.DEBUG)
>>> from random import shuffle
>>> l = list(range(100))
>>> shuffle(l)
>>> from stacksort import quicksort
>>> quicksort(l)
...

About

Attempt to sort a list by blindly executing code from StackOverflow. Inspired by XKCD Ineffective Sorts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published