Seven Tips To Clean Code With Python - Deepstash

Hallelujah! That is what I thought when I learned about the Python 3.6+ update that includes a new way of formatting strings: the Python formatted string literal. String formatting in Python has co...

1

STASHED IN:

2

Seven Tips To Clean Code With Python

medium.com

STASHED IN:

0 Comments

Making your Python code as re-usable as possible should be one of your main concerns. But what if you’re working on a Unix platform and your colleague is working on Windows?

The path delimite...

STASHED IN:

1

Unpacking variables are probably most used for functions that return multiple variables, such as in the example below.

But it is also useful for data types that contain multiple items. The on...

STASHED IN:

1

Dictionaries are great data-types for storing values with an attribute field known as the key , in so-called key-value pairs . When extracting key-value pairs...

STASHED IN:

1

I love the zip function and it has saved me countless (nested) loops. I use it mostly for iterating over two data types at the same time, where I need the indexes to be equal.

Yo...

STASHED IN:

1

List, tuple, and dictionary comprehensions are ways to code more efficiently: do the same in fewer lines of code.

Both lines 2-4 and lines 13-15 are compressed in si...

STASHED IN:

1

the * prefix operator was added to the multiple assignment syntax, allowing us to unpack the remaining items in an iterable.

The ** operator does something similar, ...

STASHED IN:

1

Deepstash helps you become inspired, wiser and productive, through bite-sized ideas from the best articles, books and videos out there.

GET THE APP: