Python

Combined Stream

6 thoughts
last posted Sept. 24, 2016, 8:46 a.m.
get stream as: markdown or atom
Sign Up
0

Working on a Python tech-lab. It's going to talk about the Python ecosystem, Openstack, and how to make the most of it.

Licensed under CC-BY-SA 4.0 when it's done!

0

asyncio is nice, but at don't see it working outside of a niche. The problem is that a library is either written for asynchronicity or not, and if it's not, it can't be converted, and it can be used in an asynchronous framework (I believe monkeypatching is not a real solution, since it just make some synchronous code asynchronous, sweeping all synchronization problems under the rug).

That means that we have to ecosystems: you can't use requests with asyncio. The only solution would be to implement all IO libs in an asynchronous way and to provide blocking wrappers for synchronous usage (like what crochet does), but that's not going to happen. asyncio is not the messiah everybody seems to think it is, and will soon be forgotten outside of circles where people need concurrency.

0

The copy module provides methods for both shallow and deep copy which allow you to copy mutable structures like dictionaries if you want to avoid mutating dictionaries that are passed to your code.

0

Discovered the array module for representing homogeneous data.

Also this very neat tip for creating a byte string from an array of integers.

0

More binary/string/decimal operations:

"{0:032b}".format(my_int)

Converts an int into a string of zeroes and ones (32 for 32-bit number).

int(my_string, 2)

Converts a string of zeros and ones into an integer

0

Convert a tuple to a named tuple with the star modifier

my_named_tuple = MyNamedTuple(*a_tuple)

From Stack Overflow