I have background with mostly JavaScript and a strong type language such as Java.
Because Python's popularity in Machine learning, AI, data science, as well as backend web development, I decided to really learn it. I have observed that it has very elegant, and clean syntax which enforces us to think of the code on a high level (not too worried about the little detail) and to format code nicely with its strict indentation rule.
Below is some Python and JavaScript's code snippets to illustrate some common usages and language comparison.
I hope to write more advanced Python topics (I need to learn them first :-p) in future post:
- [] generators
- [] iterators
- [] decorators
If you have any comments and tips, please write below.
For side-by-side code comparison: https://leetcode.com/playground/vDy2x7Co/shared
Top comments (5)
I am really looking forward to more content from you. I am from ruby on rails background and recently switched to python background recently.
In two months I learnt the following, ipython shell which is far better than default python shell that I have been using. It has function name completions, commands repeat to name a few of its features.
One thing I loved the most is that I could look into the doc string in the shell itself by simply appending ? to the end of the function name. Example lets say I have a class test and there is an instance function run. In the console I simply type test.run? and I get the doc string for that. I find it pretty cool and amazing.
Do you have any such tips that you can share with us?
Thanks for sharing the tips. They are useful to know.
If you are curious about the language itself, there are many good resources online. Here are a few:
book.pythontips.com/en/latest/
hackernoon.com/python-tricks-101-2...
But it seems like you are curious about the work flow and tools to make development easier.
I use VS code and install python extension which allows me to run and debug python code easily.
Thanks for sharing the links.
list[::3] # [1, 3, 5, 7, 9]
That should be list[::2] btw :)
@V Dedo, nice catch. I updated the code. Thanks.