Markdown’s code block is great for writing code snippets. However, when you try to publish or share it via blogging platform there are some shortcomings. Gist can help to bridge the gap. Gist makes your blog look better & easier to maintain. In this post, Let us see how automated gist creation can improve your technical blogging experience.

Gist Intro

Gist is a GitHub repository where you can store & share code/data with others. A single gist can store multiple files. Syntax highlighting is supported based on the file extension type, so be careful when you name the file. Gists can be public or secret. Do note that secret gists aren’t private, meaning anyone with the URL would be able to view the code/data.

Why to use gist?


Build a digit emoji predictor in Jupyter notebook by passing data between JavaScript & Python. Typically, JavaScripts are used for data visualization in notebooks, but it can also be used for prototyping front-end/UI for deep learning models.

Why the hell build UI in Notebook?

Short Answer:

Share the Deep Learning model notebook with colleagues from different teams like Business, Data Science, Front End developer, DevOps for their opinion before the real software development takes place.

Jupyter notebook is meant for quick prototyping and everyone knows this but what many misses is we can also do a quick prototype of UI as well. Many data scientists are quick to start building the big deep learning model with whatever little data they have without even thinking about what they are developing and for whom 🤷‍♂️. Trust me, the first model you are satisfied with (based on…


Most Python programmers are guilty (me included) of always using List without even considering Tuple at all. Surely for some use cases, Tuple should be better right? Keep reading for one such case.

Tuple is like List but immutable so it has lesser in built methods. Tuples are faster than Lists, but it is noticeable only when size of the tuple is considerably large. If you want a refresher, check out this blog by Michael Galarnyk

Caveat

A general rule of thumb is to use Tuple only when the data will or should not change.

# Create Tuple with two elements
tup = (1, [2])
# Re-assign first element
tup[0] = 3
Tuple is immutable so it doesn’t support item assignment.

This does not mean you really can’t change a tuple. If the underlying tuple element is mutable then we can change it…


In python, try and except blocks are often used by programmers for handling any exception or unhappy scenarios. Finally clause is very under appreciated & can be better utilised. Let us check out how final-block works.

Deep dive

No matter what happened previously, the final-block is executed once the code block is complete and any raised exceptions handled. Even if there’s an error in an exception handler or the else-block and a new exception is raised, the code in the final-block is still run.

This quote from the python documentation is absolutely correct but the execution behavior is little tricky when try and finally blocks are encapsulated within a function which has a return statement. Let me explain with examples. See if you could guess the output of the following functions.

Example 1:

# Both the try & final blocks…


Writing a function in python is easy but writing a good function is not that easy. Most python programmers are often not aware of how to write clear and concise functions, let alone using Type Dispatch. Let us see how we can write better functions in python using Type Dispatch.

Getting Started

Before we get into what is Type Dispatch? or How Type dispatch can make you a better Python programmer, let us get some basics out of the way like What is a good python function? To be honest, I would rather let Jeff Knupp explain it.

I truly believe that the only way to really understand howsomething works is by breaking it into granular pieces and putting it back together or building it from scratch. Let us take a very well-defined use case and write a function for it from scratch. …

Aravind Ramalingam

Sharing my journey with Python, Computer Vision, Deep Learning and everything related to it. This includes the good, the bad and the ugly. Twitter: @6aravind

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store