Skip to content Skip to sidebar Skip to footer
Showing posts with the label Python Internals

Python: Understanding Iterators And `join()` Better

The join() function accepts an iterable as parameter. However, I was wondering why having: text = &… Read more Python: Understanding Iterators And `join()` Better

Python 3.4 Multiprocessing Queue Faster Than Pipe, Unexpected

I am doing an audio player that received samples from an udp socket, and everything was working fin… Read more Python 3.4 Multiprocessing Queue Faster Than Pipe, Unexpected

Handling Map Function In Python2 & Python3

Recently i came across a question & confused with a possible solution, code part is // code p… Read more Handling Map Function In Python2 & Python3

How Does __slots__ Avoid A Dictionary Lookup?

I've heard that __slots__ makes objects faster by avoiding a dictionary lookup. My confusion co… Read more How Does __slots__ Avoid A Dictionary Lookup?

What Makes Lists Unhashable?

So lists are unhashable: >>> { [1,2]:3 } TypeError: unhashable type: 'list' The f… Read more What Makes Lists Unhashable?

Printing Without Parentheses Varying Error Message Using Python 3

When I try to use print without parentheses on a simple name in Python 3.4 I get: >>> prin… Read more Printing Without Parentheses Varying Error Message Using Python 3

How Does Cpython Determine Whether A User Supplied An Optional Argument?

I started wondering how CPython can tell the difference between None as a default argument and None… Read more How Does Cpython Determine Whether A User Supplied An Optional Argument?

How Does Module Loading Work In Cpython?

How does module loading work in CPython under the hood? Especially, how does the dynamic loading of… Read more How Does Module Loading Work In Cpython?

Why Don't Tuples Get The Same Id When Assigned The Same Values?

When I executed the following steps, both tuples (a and b) haven't retained their original IDs … Read more Why Don't Tuples Get The Same Id When Assigned The Same Values?

Why Isn't My Dict Lookup Faster Than My List Lookup In Python?

I'm reading each line of a file into both a list and a dict, with open('../data/title/prune… Read more Why Isn't My Dict Lookup Faster Than My List Lookup In Python?

What Does "del" Do Exactly?

Here is my code: from memory_profiler import profile @profile def mess_with_memory(): huge_lis… Read more What Does "del" Do Exactly?

Converting A Series Of Ints To Strings - Why Is Apply Much Faster Than Astype?

I have a pandas.Series containing integers, but I need to convert these to strings for some downstr… Read more Converting A Series Of Ints To Strings - Why Is Apply Much Faster Than Astype?

Is An Explicit Nul-byte Necessary At The End Of A Bytearray For Cython To Be Able To Convert It To A Null-terminated C-string

When converting a bytearray-object (or a bytes-object for that matter) to a C-string, the cython-do… Read more Is An Explicit Nul-byte Necessary At The End Of A Bytearray For Cython To Be Able To Convert It To A Null-terminated C-string

Why Don't Tuples Get The Same ID When Assigned The Same Values?

When I executed the following steps, both tuples (a and b) haven't retained their original IDs … Read more Why Don't Tuples Get The Same ID When Assigned The Same Values?