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

Python: Why Are * And ** Faster Than / And Sqrt()?

While optimising my code I realised the following: >>> from timeit import Timer as T >&… Read more Python: Why Are * And ** Faster Than / And Sqrt()?

Python: Which Types Support Weak References?

Code: from weakref import WeakSet se = WeakSet() se.add(1) Output: TypeError: cannot create weak r… Read more Python: Which Types Support Weak References?

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

Efficiency Of Sorting By Multiple Keys In Python

I have a list of strings that I want to sort by two custom key functions in Python 3.6. Comparing t… Read more Efficiency Of Sorting By Multiple Keys In Python

Why Doesn't The Namedtuple Module Use A Metaclass To Create Nt Class Objects?

I spent some time investigating the collections.namedtuple module a few weeks ago. The module uses … Read more Why Doesn't The Namedtuple Module Use A Metaclass To Create Nt Class Objects?

Why Does + (plus) Can Concatenate Two Strings In Python?

I'm learning Learn Python the hard way. w = 'This is the left side of...' e = 'a st… Read more Why Does + (plus) Can Concatenate Two Strings In Python?

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?

Memory Size Of List Python

I was experimenting something with lists and I came around self-referencing lists. I searched throu… Read more Memory Size Of List Python