Incorporate the Best Practices for Python with These Top 4 VSCode Extensions

Motivation

As a data scientist, it is essential to have good coding practices because it is easier for coworkers viewing your code and for you to avoid confusion when revisiting your code in the future. You want your code to be both clean and easy to understand.

Thus, it is essential to:

  • Include type hint
  • Write good documentation
  • Keep the relevant variables and functions and import relevant packages
  • Highlight the code that needs attention or improvements
  • Avoid other trivial mistakes such as forgetting to declare the variables

Instead of trying to pay attention to several small details in your code at once, why not using extensions to assist and remind you? This will help cultivate good coding practices.

VSCode is my favorite IDE because of its useful keyboard shortcuts and extensions. I wrote about my favorite keyboard shortcuts and how these top 4 code viewers in VSCode make it easier for me to review my data. In this article, I will introduce 4 of my favorite VSCode extensions for good coding practice.

Python Type Hint

Type hinting indicates the type of value within your Python code, making it easier for the people who use your functions or classes to know which datatype to insert for a specific parameter in your functions or classes.

For example, by adding type information to a function, it reminds those who use your code to insert an argument of type datetime.

#python #programming #data-science #coding #vscode

What is GEEK

Buddha Community

Incorporate the Best Practices for Python with These Top 4 VSCode Extensions
Ray  Patel

Ray Patel

1619518440

top 30 Python Tips and Tricks for Beginners

Welcome to my Blog , In this article, you are going to learn the top 10 python tips and tricks.

1) swap two numbers.

2) Reversing a string in Python.

3) Create a single string from all the elements in list.

4) Chaining Of Comparison Operators.

5) Print The File Path Of Imported Modules.

6) Return Multiple Values From Functions.

7) Find The Most Frequent Value In A List.

8) Check The Memory Usage Of An Object.

#python #python hacks tricks #python learning tips #python programming tricks #python tips #python tips and tricks #python tips and tricks advanced #python tips and tricks for beginners #python tips tricks and techniques #python tutorial #tips and tricks in python #tips to learn python #top 30 python tips and tricks for beginners

Ray  Patel

Ray Patel

1619510796

Lambda, Map, Filter functions in python

Welcome to my Blog, In this article, we will learn python lambda function, Map function, and filter function.

Lambda function in python: Lambda is a one line anonymous function and lambda takes any number of arguments but can only have one expression and python lambda syntax is

Syntax: x = lambda arguments : expression

Now i will show you some python lambda function examples:

#python #anonymous function python #filter function in python #lambda #lambda python 3 #map python #python filter #python filter lambda #python lambda #python lambda examples #python map

Ray  Patel

Ray Patel

1619571780

Top 20 Most Useful Python Modules or Packages

 March 25, 2021  Deepak@321  0 Comments

Welcome to my blog, In this article, we will learn the top 20 most useful python modules or packages and these modules every Python developer should know.

Hello everybody and welcome back so in this article I’m going to be sharing with you 20 Python modules you need to know. Now I’ve split these python modules into four different categories to make little bit easier for us and the categories are:

  1. Web Development
  2. Data Science
  3. Machine Learning
  4. AI and graphical user interfaces.

Near the end of the article, I also share my personal favorite Python module so make sure you stay tuned to see what that is also make sure to share with me in the comments down below your favorite Python module.

#python #packages or libraries #python 20 modules #python 20 most usefull modules #python intersting modules #top 20 python libraries #top 20 python modules #top 20 python packages

Incorporate the Best Practices for Python with These Top 4 VSCode Extensions

Motivation

As a data scientist, it is essential to have good coding practices because it is easier for coworkers viewing your code and for you to avoid confusion when revisiting your code in the future. You want your code to be both clean and easy to understand.

Thus, it is essential to:

  • Include type hint
  • Write good documentation
  • Keep the relevant variables and functions and import relevant packages
  • Highlight the code that needs attention or improvements
  • Avoid other trivial mistakes such as forgetting to declare the variables

Instead of trying to pay attention to several small details in your code at once, why not using extensions to assist and remind you? This will help cultivate good coding practices.

VSCode is my favorite IDE because of its useful keyboard shortcuts and extensions. I wrote about my favorite keyboard shortcuts and how these top 4 code viewers in VSCode make it easier for me to review my data. In this article, I will introduce 4 of my favorite VSCode extensions for good coding practice.

Python Type Hint

Type hinting indicates the type of value within your Python code, making it easier for the people who use your functions or classes to know which datatype to insert for a specific parameter in your functions or classes.

For example, by adding type information to a function, it reminds those who use your code to insert an argument of type datetime.

#python #programming #data-science #coding #vscode

How To Compare Tesla and Ford Company By Using Magic Methods in Python

Magic Methods are the special methods which gives us the ability to access built in syntactical features such as ‘<’, ‘>’, ‘==’, ‘+’ etc…

You must have worked with such methods without knowing them to be as magic methods. Magic methods can be identified with their names which start with __ and ends with __ like init, call, str etc. These methods are also called Dunder Methods, because of their name starting and ending with Double Underscore (Dunder).

Now there are a number of such special methods, which you might have come across too, in Python. We will just be taking an example of a few of them to understand how they work and how we can use them.

1. init

class AnyClass:
    def __init__():
        print("Init called on its own")
obj = AnyClass()

The first example is _init, _and as the name suggests, it is used for initializing objects. Init method is called on its own, ie. whenever an object is created for the class, the init method is called on its own.

The output of the above code will be given below. Note how we did not call the init method and it got invoked as we created an object for class AnyClass.

Init called on its own

2. add

Let’s move to some other example, add gives us the ability to access the built in syntax feature of the character +. Let’s see how,

class AnyClass:
    def __init__(self, var):
        self.some_var = var
    def __add__(self, other_obj):
        print("Calling the add method")
        return self.some_var + other_obj.some_var
obj1 = AnyClass(5)
obj2 = AnyClass(6)
obj1 + obj2

#python3 #python #python-programming #python-web-development #python-tutorials #python-top-story #python-tips #learn-python