Effective Python: 59 Specific Ways to Write Better Python (Effective Software Development Series)

Author: Brett Slatkin
4.6
This Year Stack Overflow 1
This Month Reddit 2

Comments

by visene   2019-07-21

Effective python is an awesome book if you already know programming or if you already know python.

https://www.amazon.com/Effective-Python-Specific-Software-Development/dp/0134034287/

by slowpush   2019-07-21

You only need two

Python Tricks

https://dbader.org/products/python-tricks-book/

Effective Python

https://www.amazon.com/Effective-Python-Specific-Software-Development/dp/0134034287

​

Everyone recommends Fluent Python, but I think it's a little too dense for an intermediate book. You won't appreciate the book until much later.

by onenote   2019-07-21

I'm a big fan of Effective Python for learning idiomatic Python. It has some good sections on concurrency and the limitations of threads in Python. That info on concurrency is before asyncio came out (3.5+), but still pretty helpful.

As far as data driven concerns, I really recommend checking out Designing Data Intensive Applications. Its a language/solution neutral survey of most of the popular solutions and patterns for processing and storing data (relational stores, columnar stores, kafka, all that good stuff). It gives a great overview of the low level details and tradeoffs of each solution.

Python can certainly scale if you're setting up your servers properly, but its main benefit is in being flexible! Good luck!

by tom1018   2019-07-21

Effective Python

https://smile.amazon.com/Effective-Python-Specific-Software-Development/dp/0134034287

by basking2   2019-07-21

I often look for an "Effective Foo" book to learn a language at a deeper level.

https://www.amazon.com/Effective-Python-Specific-Software-Development/dp/0134034287/ref=sr_1_2?keywords=essential+python&qid=1551409979&s=gateway&sr=8-2

They typically prompt me to ask, "why?" I rarely finish them because by about 1/3 of the way in I've accidentally unraveled enough to keep me busy.

I don't claim this will be effective for everyone, but it's a habit that's served me well for a few new languages.

by anonymous   2018-03-19

You can simply convert string to bytes using:

a_string.encode()

and you can simply convert bytes to string using:

some_bytes.decode()

bytes.decode and str.encode have encoding='utf-8' as default value.

The following functions (taken from Effective Python) might be useful to convert str to bytes and bytes to str:

def to_bytes(bytes_or_str):
    if isinstance(bytes_or_str, str):
        value = bytes_or_str.encode() # uses 'utf-8' for encoding
    else:
        value = bytes_or_str
    return value # Instance of bytes


def to_str(bytes_or_str):
    if isinstance(bytes_or_str, bytes):
        value = bytes_or_str.decode() # uses 'utf-8' for encoding
    else:
        value = bytes_or_str
    return value # Instance of str