You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While this marvelous library is obviously saving everyone a lot of time going back and forth between SO, clipboard, and their IDE, I feel its usage is still not as straightforward as it could be.
For example, in this snippet:
fromstackoverflowimportsplit_into_chunksprint(list(split_into_chunks.chunk("very good chunk func")))
you still need to know to call a chunk function from the imported module. It could've been chunks, split, or whatever else (depending on what the SO answer chose), forcing the programmer to (gasp!) look at the code he or she imports and perhaps even understand it.
I'd suggest that the importer should be clever enough to pick the correct function for the programmer, and then make the imported symbol itself callable:
fromstackoverflowimportsplit_into_chunksprint(list(split_into_chunks("very good chunk func")))
The heuristics of making the correct choice are left as exercise for the reader.
The text was updated successfully, but these errors were encountered:
Additional heuristic: in code blocks which contain viable executable code theoretically applicable to the problem, bare / outside the scope of a declared function, isolate the initial literal assignment(s) (which is/are most typically the sample input value(s) in short code demonstrations), remove it/them, and use the labels as the argument names of the generated callable. (Any trailing print call may be suitable for transformation into the final return.)
E.g. this following bare snippet in answer to "how do you multiply two numbers together":
While this marvelous library is obviously saving everyone a lot of time going back and forth between SO, clipboard, and their IDE, I feel its usage is still not as straightforward as it could be.
For example, in this snippet:
you still need to know to call a
chunk
function from the imported module. It could've beenchunks
,split
, or whatever else (depending on what the SO answer chose), forcing the programmer to (gasp!) look at the code he or she imports and perhaps even understand it.I'd suggest that the importer should be clever enough to pick the correct function for the programmer, and then make the imported symbol itself callable:
The heuristics of making the correct choice are left as exercise for the reader.
The text was updated successfully, but these errors were encountered: