Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.47 KB

README.md

File metadata and controls

45 lines (32 loc) · 1.47 KB

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)
...