Live data from Hacker News

StackOverflow Importer – Import code from Stack Overflow as Python modules

github.com

51–60 of 87 posts

Re: StackOverflow Importer – Import code from Stack Overflow as Python modules

#51
post #42

Earlier quoted context omitted.

Very funny. I hadn't seen this before. I particularly like: >>Is it safe? >>Uh… it evals both user input and random code, unchecked, from an external site. This is what security-minded folks would refer to as Very Bad™.

I do my best to make it safe(ish), though :) It only runs code samples that were posted before I made StackSort.

Thank you for implementing stacksort!

Re: StackOverflow Importer – Import code from Stack Overflow as Python modules

#52
It's interesting to imagine adding something like this to an editors auto complete or as some kind of search function to automate functions you've coded a million times.

I.e. maybe you type: "repeat a function over a list python" in a special format and your editor pastes in the accepted answer from stackoverflow for you to choose whether that's acceptable / whether you want to use it as a template. Then maybe you could get into a better flow without ever having to stop what you're doing to Google something ... It would all just show up magically in your editor.

You could even have libraries of common answers written in such a way that you could write expected input and output formats and then get a code fragment that would fit that description. Something like a more organized test driven development. Though that would really only work for very specific things. Improve these ideas enough and make them more general - and maybe you could improve programmer productivity by quite a large margin.

Disclaimer: I know the OP was a joke but I see no problem with reusing code if you understand what its doing and the costs / trade-offs for doing so.

Re: StackOverflow Importer – Import code from Stack Overflow as Python modules

#54
post #3

because executing arbitrary unknown code is always a good idea

On the other hand, at least the code has gone through some review. Compare that to NPM or PyPI, which is full of crap. Some of the modules in PyPI were merely ads for putlocker, without even a single line of Python.

>Some of the modules in PyPI were merely ads for putlocker

Seriously? Are they still there?

Re: StackOverflow Importer – Import code from Stack Overflow as Python modules

#55

Relevant xkcd: https://xkcd.com/1185/ "StackSort connects to StackOverflow, searches for 'sort a list', and downloads and runs code snippets until the list is sorted."

  "StackSort connects to StackOverflow, searches for 'sort a
  list', and downloads and runs code snippets until the list is
  sorted."
If still unable to sort a list, it'll emit an arbitrary sorted list as the result.

Re: StackOverflow Importer – Import code from Stack Overflow as Python modules

#58

Relevant xkcd: https://xkcd.com/1185/ "StackSort connects to StackOverflow, searches for 'sort a list', and downloads and runs code snippets until the list is sorted."

And https://gkoberger.github.io/stacksort/ is an actual implementation of that sort.

Re: StackOverflow Importer – Import code from Stack Overflow as Python modules

#60
post #42

Earlier quoted context omitted.

Very funny. I hadn't seen this before. I particularly like: >>Is it safe? >>Uh… it evals both user input and random code, unchecked, from an external site. This is what security-minded folks would refer to as Very Bad™.

I do my best to make it safe(ish), though :) It only runs code samples that were posted before I made StackSort.

What if someone edits an answer posted before you made it?
Post reply on HN