Meetups

Python Ten-X Developer.

Inspired by David Bordeynik’s lecture on PyWeb-IL meetup.

So what is the meaning of the definition "Ten-X Developer"!?

This term used to describe a developer that is 10 times more productive then his colleagues in his sphere.

In this article I will drop light on 3 fundamentals of programming and show how a ten-x developer would act.

 

2019-05-16 00_54_39-Ten-x Python Developer - Google Slides

Let's start from organization.

2019-05-16 01_04_45-Ten-x Python Developer - Google Slides

Virtual Environments

Keep an environment for each project.Usage of virtual environments will help you avoid conflicts between the libraries versions. At the example we can see that installation of a package from specific version cause removal of the existing one.

2019-05-16 01_31_07-Ten-x Python Developer - Google Slides

There is an example for a usage of virual environments when each project has it's separate environment with a right lib version.

Untitled

Command Line Arguments  

Under this topic I will present a module called argparse. This module will make your life easier received and parsing user input from a command line.

Screen Shot 2019-05-24 at 19.27.58

As it presented at the example above, it is possible to pess arguments type, name and description as the argument will described as --help command used(example bellow).

Screen Shot 2019-05-24 at 19.32.21

Lock Requirements Versions

Always lock you project requirements versions so they will be the same as at the production environment.It will make your life much easier debugging bugs on production.

2019-05-09 14_52_21-vvlogo.png - Paint

Now to the second topic which will be Syntax..(Disclaimer!: It will be sweet)

suger

Keyword Arguments And Documentation

Keep your code clean, document each function, add meaning in your variables names and use keyword argument when invoking functions.

Screen Shot 2019-05-25 at 0.21.28

With Statments

One of the most popular use case for a with statement is file management. Using with statement you can prevent situations in which you leave your files open.

Screen Shot 2019-05-25 at 0.25.51

Another use case is suppressing exceptions without try/except statements.

Screen Shot 2019-05-25 at 0.42.04

Decorators

Decorators allow adding new functionality to a function without modifying it's structure.

Here is an example:

Screen Shot 2019-05-25 at 0.50.11

At the example exception handling added to function without modifying it.

And the last but not the least will be performance improvement.

Screen Shot 2019-05-25 at 0.57.28

logging Module

Using logging module over regular print will cut the run time.

Screen Shot 2019-05-25 at 1.01.30

Another advantage of the logging module is the ability to avoid usage of unnecessary requirements.

Screen Shot 2019-05-25 at 1.08.45

And finally  logging module providing the ability to filter the logging on a production environment.

Screen Shot 2019-05-25 at 1.10.45

Generators 

I will explain you the generator concept on a practical example(os.listdir() and os.scandir()).

so..

  • os.listdir is an iterator what which means that all the file paths will be loaded to the memory.
  • os.scandir will load one file at a time what will save our program from crashing when accessing a directory with large amount of files.
  • Generator returns an iterator object with one value at a time.

 

And here is a simple generator implementer by me:

Screen Shot 2019-05-25 at 1.20.08

In-Memory Files

In-memory files will help you avoid accessing physical paths, what will secure you from permission problems and more.

Here is in example:

Screen Shot 2019-05-25 at 1.22.31

And it is time to summarise:

  • A Ten-x developer is an individual who is thought to be as productive as 10 others in his or her field.
  • Use different interpreter for each project.
  • Lock your requirements version.
  • Keep your code understandable and document it.
  • Use logging module instead of printing, it will improve the performance and will give you more control on your logging.

 

Thank you for reading!

15 thoughts on “Python Ten-X Developer.

  1. Wow, this blog is amazing and interesting. Can’t wait to see which more new things you prepare in the future.

  2. magnificent post, very informative. I wonder why the other experts of this sector do not notice this. You should continue your writing. I’m sure, you’ve a huge readers’ base already!

  3. I am really impressed with your writing skills as well as with the
    layout on your blog. Is this a paid theme or did you customize it yourself?
    Either way keep up the excellent quality writing, it is
    rare to see a nice blog like this one nowadays.

  4. Its like you learn my mind! You seem to know a lot approximately this, like you wrote the book in it or something. I believe that you just can do with some p.c. to power the message house a bit, but other than that, this is magnificent blog. A great read. I will definitely be back.| а

  5. I just want to say I am very new to blogs and absolutely savored you’re blog. Probably I’m likely to bookmark your blog . You amazingly come with really good articles and reviews. Kudos for sharing with us your web page.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top