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

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?

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

In-place Custom Object Unpacking Different Behavior With __getitem__ Python 3.5 Vs Python 3.6

a follow-up question on this question: i ran the code below on python 3.5 and python 3.6 - with ver… Read more In-place Custom Object Unpacking Different Behavior With __getitem__ Python 3.5 Vs Python 3.6

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?

Python 2 Assumes Different Source Code Encodings

I noticed that without source code encoding declaration, the Python 2 interpreter assumes the sourc… Read more Python 2 Assumes Different Source Code Encodings

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?

How Does The Python For Loop Actually Work?

I am curious to understand how Python for loops work under the hood. I tried to implement it somewh… Read more How Does The Python For Loop Actually Work?