Python Coding techniques and programming practices are one of the features of a professional programmer. While writing code to solve a problem programmer should make simple choices and have to use basic techniques. This completely depends on the programmer's skill and expertise and how wisely he make choices.
Coding techniques are basically focused on improvising the readability and maintainability of the code.
Programming practices are mainly focused on the performance of the code and its enhancements.
coding techniques serve developers as a guide for developing a standard code for a software system. These are categorised into three sections.
Names are most influenceable part to understand the logical flow or concept of the code what it mean to be or what it do . ( use related words as variables )
Comments:
Format :
It is very important when we are coding for larger projects because the code is altered by a team. so, programmer should format the code in such way that others can easily debug the code and can modify it easily.
follow pep8 standards
1. Looping over numbers:
Better way
2. Looping over a list
Better way
3. Looping over a list and its idices
Better way
4. Looping backwards
Better way
5. sorting in ascending order
6. sorting in descending order
7. looping over two collections
Better way
8. looping over dictionary keys and values
Better way
Best way
10. construct a dictionary from two lists
Better way
izip is faster than zip, zip computes all the list at once, izip computes the elements only when requested. One important difference is that 'zip' returns an actual list, 'izip' returns an 'izip object', which is not a list and does not support list-specific features (such as indexing).
11. using comparison operator
Best way
note: comparison operator always returns a boolean[True, False]
12. achieve switch/case in python with dict
13. convert a list of strings to numbers
Best way
14. multiplying numbers a list of numbers
Best way is
15. finding multiples of 3 from a random set of numbers
Better way is
Micropyramid is a software development and cloud consulting partner for enterprise businesses across the world. We work on python, Django, Salesforce, Angular, Reactjs, React Native, MySQL, PostgreSQL, Docker, Linux, Ansible, git, amazon web services. We are Amazon and salesforce consulting partner with 5 years of cloud architect experience. We develop e-commerce, retail, banking, machine learning, CMS, CRM web and mobile applications.
Django-CRM :Customer relationship management based on Django
Django-blog-it : django blog with complete customization and ready to use with one click installer Edit
Django-webpacker : A django compressor tool
Django-MFA : Multi Factor Authentication
Docker-box : Web Interface to manage full blown docker containers and images
More...