Programming

Python

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

Convert a tuple to a named tuple with the star modifier

my_named_tuple = MyNamedTuple(*a_tuple)

From Stack Overflow

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

Discovered the array module for representing homogeneous data.

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

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.

Child Streams

Flask

3 thoughts
updated May 1, 2017, 9:04 p.m.