1

I have written a python script that takes in data analyses them and gives some results. I want to write a blog post analyzing these results. I am not sure if I should include my python script in the blog post and how much should I explain it ?

I want to emphasize the python aspect. Maybe in a separate post ? Do you know any examples I should look ?

2

You might want to put the Python script into a GitHub project, and then link to that project from your blog post. If a reader is not interested in the script, it is easy for them to ignore the link. But if a reader is interested in the script, then they will likely also appreciate GitHub’s high-quality code-viewing features, and easy code-sharing features. They may even send you patches or improvements to your code. And there is a certain cachet to being the maintainer of a GitHub project. Schools and employers are often impressed by that. You can maintain the focus on the results in your blog post and the focus on the code in your GitHub project.

2

I often put snippets of code right into bodies of text. When I do, I typically format it in courier or another fixed-space font, and indent the entire code one or two tabs. It makes it more obvious that it's code so that uninterested parties can skim past it.

  • This may be helpful for SEO reasons, also -- people searching for the specific code snippet type would find your specific analysis of it, not just contextless github. (I don't use GitHub, and I'm not a coder, so I may be very wrong, of course.) – April --Un-Slander Monica-- May 20 at 13:54
1

Blogs can have many purposes. They can be to inform others, they can be to gain an audience, they can even be just a personal journal with the distinction that it's readable by others. Assuming you yourself are the driving force behind the blog, then just remember that you call the shots and there's really no rules you need to abide by. Just write it however you feel it should be written. If you find you're giving it too much thought to the point it's becoming a chore, then why bother?

With that said, here are some pointers for your situation. If the blog is primarily an online journal of your activities for your future self, then you probably want to include the code in case you find later down the road that you need to reuse it. If the blog is to inform others, then consider whether your main accomplishment is related to the script, the analysis, or the results, or some combination. For example, if you feel your script is really clever and does the bulk of the analysis automatically, then include it in the body and explain it (in addition to the code comments inline). If the script mainly serves to 'massage' the data (narrow down large amounts of data and get it into a format readable by humans for example) and the human is doing the bulk of the analysis, then maybe the script is better off as an appendix near the bottom of your post. If your blog exists mainly to inform readers of the results of your analysis, then you could even omit the script altogether or put it in a separate blog intended for Python developers.

1

You will have to decide what is important. If you look at the DZone website, it has links to a large number of blogs. Sometimes these blogs include code and sometimes they don't depending on the purpose and focus of the blog. I would recommend you visit the site and see.

1

GitHub pages, which allows you to keep your script and to post the analyses in the blog, may fill the bill.

Follow the README in this project, you'll dig it out within less than one hour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.