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

Tokyo House Hunting Guide

First of all, I am glad to know that you have decided to find a relatively long-term accommodation space in Tokyo. It’s a marvelous city and I hope you will have a fantastic time living here ~ The ideal procedure would be to lookup apartments in your desired area on these websites and then go an agency. Most apartments won’t be furnished and will have the initial surcharges and key deposit money, ~one month’s rent. The agency I used for my apartment is ABLE, and I would highly recommend it. I have a contact at ABLE Hakusan, so if you are looking for housing in Bunkyo-ku, near the universities, ping me up and I may perhaps be able to get you a bit of a discount, haha ;) Some relevant links are, https://suumo.jp/sp/ : This is the largest real-estate website in Japan, with the most number of properties listed. Most of the information is in Japanese though. https://minimini.jp/sp/ : The second most popular real-estate website in the country. Suumo is Green, while MiniMini is Red. Both of...

एक पत्र सकुरा के नाम

ऐसा हो ही नहीं सकता कि आप टोक्यो में हो और दो महीने पहले से आपकी सारी दिनचर्या तय हो गई हो, आपके ना जाने के सिर्फ़ दो करण हो सकते हैं, एक : आपको जाने की इच्छा नहीं है (संभवतः यह), या फिर दो : आप उस दिन टोक्यो में नहीं हो। आप जापानी लोगों की इस प्रकार की आदतें हमें बिलकुल भी पसंद नहीं है। दुनिया में कुछ ही चुनिंदा लोग होंगे जो हमसे ज़्यादा काम करते होंगे, क्योंकि सभी के पास बराबर का वक़्त है, २४ घंटे। तो अगर साथ चलने की इच्छा है और उस एक लौते दिन या समय इत्यादि की ही दिक़्क़त है, तो फिर ज़ाहिर है साथ मिलकर उसे सुलझाया जा सकता है। यूँ संचिप्त में बेमतलब का उत्तर देना बेहद ही अपमानजनक है। यह हमारी नज़रों में आप जापानीयों की अधूरी परवरिशों का भी सूचक है, जहां आपको यह तो सिखाया जाता है कि बाहरी सुंदरता और गोरा रंग कैसे लाए, मगर इस पर ज़ोर दिया जाता कि दोस्त कैसे बनाए और दोस्ती किसे निभाए। आधुनिक जापानी समाज के अंदरूनी खोखलेपन और इसकी दरारों से सीप रहीं अकेलापन और मानसिक तकलीफ़ों के एहसासों की जड़े शायद यही ग़ैर समाजीपन होना है। चिरंचे, हाल ही में हमारे कम से कम तीन जापानी दोस्तों और परिचित...