Skip to main content

astropy@GSoC Blog Post #4, Week 4 - Lessons in CodeStyle

Damn yaar! 
I didn't know this. Astropy can be a dangerous place. There are codestyle ninjas present. Hidden in plain sight. It's not just the PEP8 speaks from GitHub actions. There are real people in it too. And worse of all they don't allow merging the Pull Request (PR) until we do what they say. All in the name of adhering to modern standards that improve readability. What has open source come to! Really?

This and the past week, below listed is what the codestyle ninjas have made me do to my otherwise perfectly working code: (copied without permission from GitHub)
  • TABLE should not be used as a variable name
  • No camelCase anywhere. For example, tableDescription should be table_description.
  • Module level variables as SCREAMING_SNAKE_CASE. E.g. BYTE_BY_BYTE_TEMPLATE not ByteByByteTemplate.
  • Regular variables, functions, methods are lower_case_underscore_separated, never camelCase or CapsCase.
  • Private methods start with one underscore not two, e.g. def _split_float_format instead of def __splitFloatFormat.
  • No inline blocks like, if sign: col.meta.size += 1
  • Avoid one-line variable names, but especially l that looks like 1.
  • List values alignment, dictionary values alignment, function definition line alignment, alignment this and alignment that and so on...
  • And no white-spaces please, trailing or whatever!
Yeah! For some weird reason, the codestyle ninjas at Astropy seem to hate Camels and are extravagantly fond of Snakes! Dunno why? I for one reallyLikeCamelsAndTheirCase. Ha! Ha!


Disclaimer: The above post is in jest and should not be taken seriously. Sometimes Snakes are better than Camels. AND SCREAMING SNAKES ARE MORE BETTER. All hail PEP8!

Comments

Popular posts from this blog

Review: Breakfast at Tiffany's

Breakfast at Tiffany's by Truman Capote My rating: 3 of 5 stars Hmm... hard to say whether or not I like it. The story is fine. The protagonist is spectacular. And yet, I cannot seem to whole-heartedly be fond of the novella. Parts of the story are fascinating, for instance, Holly Golightly's apparent unreserve with the budding writer narrator. I also like the opening scene which introduces the mystery of where our heroine can be at the moment. The scene brings the reader into the story and somehow or the other, we are entrapped the fast-paced New York of 1940. I would recommend the book as a tranquil read. However, honestly, with the impeccable performance by Audrey, the film version brings forth Holly's persona a tad bit more effectily. The book is outstanding, no doubt, but couple it with the movie session post reading and there you have it - " a top banana in the shock department". View all my reviews

Why I write?

Initially I wanted to title this post,  On writing Diaries , however this thought-provoking question is far better. Although it may take me a long time to be an author per se, more or less, I have been a continuous writer since my seventh grade. What started with jotting down non-sense farce on daily routines during the middle school years, has now grown into some fierce rhetoric on vast ranging topics important to me in general. So, what is it about writing that I like so much? Unlike most of my friends, what has made me go on for so long now? Why do I write? And why do I plan to write more vigorously, more persuasively and more indiscriminately than ever in the coming future? Well, there isn't any plain simple answer to these. I write because I like to write. I write because it gives reality to all of these thoughts inside my head which couldn't find an route through the tongue. I write because it often makes me feel good. I write because I find this the best way to convey my...

An Ordinary Day

To a majority of us, it is a known fact that some days are actually longer than a day. The day in question, however, wasn't. It was in fact meant to be one of the driest and the most barren of the days. The kind of a day one mostly spends snug on the bed with the largest exertion afforded to the limbs being the quiet finger pressings on a touch screen. And yet, looking back now, the singular chain of events from that day, though ordinary in themselves, assume such a perplexing proportion when taken together, that the day has remained so unequivocally imprinted in my mind. At that time I was working as a JSPS Post-Doctoral fellow in the Department of Physics at the University of Tokyo. I had come to Japan from India as a Master’s student about six years prior and had been living in Tokyo since then. Following the PhD degree, owing to my fascination with the city and in order to satisfactorily sum up my current research, I had chosen to continue at the ...