Let’s take it one step further.
from stackoverflow import quick_sort
will go through the searchresults
of[python] quick sort
looking for the largest code block thatdoesn’t
syntax error in the highest voted answer from the highest votedquestion
and return it as a module. If that answer doesn’t have any validpython
code, it checks the next highest voted answer for code blocks.
>>>fromstackoverflowimportquick_sort,split_into_chunks>>>print(quick_sort.sort([1,3,2,5,4]))[1,2,3,4,5]>>>print(list(split_into_chunks.chunk("very good chunk func")))['very ','good ','chunk',' func']>>>print("gotta take a break")gottatakeabreak>>>fromtimeimporttime>>>t1=time()>>>fromstackoverflowimporttime_delay>>>print("that's enough, let's continue coding",time()-t1)that's enough, let'scontinuecoding5.7283220291137695>>>print("I wonder who made split_into_chunks",split_into_chunks.__author__)Iwonderwhomadesplit_into_chunkshttps://stackoverflow.com/a/35107113>>>print("but what's the license? Can I really use this?",quick_sort.__license__)butwhat'sthelicense?CanIreallyusethis?CCBY-SA3.0>>>assert("nice, attribution!")
This module is PSF-licensed as I blatantly copied multiple lines of code from thePython standard library.