Bhargav Rao

Find some of my best answers on Stack Overflow

profile for Bhargav Rao at Stack Overflow, Q&A for professional and enthusiast programmers

Tools services webmasters counters generators scripts tutorials free


If you find them interesting please send me a mail.

Why is str.translate so fast in Python 3.5 compared to Python 3.4.1?

When you use str.translate in Python 3.4 and then again in Python 3.5 the speed difference in the case of ascii strings is remarkable. It is because of a change in the underlying C code. To know More, Read More!


How does str(list) work?

Calling str on any function usually calls the __str__ function of the passed argument. However for a list there is no __str__ method! What happens in this case then? To know More, Read More!


Tuple unpacking order changes values assigned

Usually while swapping two varaibles in python we use a,b = b,a. But is this same as b,a = a,b? No! Not in every case. The swapping too has an order that it follows. To know More, Read More!


How does the min/max function on a nested list works?

The min and the max function both use comparision operators to find the correct return value. But how does it decide when the lists are heterogeneous or when the list elements are strings. To know More, Read More!


How to specify multiple return types using type-hints

Type Hints were introduced in python 3.5. They specify the usage of datatypes for arguments and return values. However how should multiple return types be specified? To know More, Read More!


Deleting consonants from a string in Python

Deleting consonants from a string seems very easy. But how many ways can you do that using Python? Also which is the best way to remove them? To know More, Read More!


How to remove \n from a list element?

Stripping new lines from a list seems very easy. But how many ways can you do that using Python 3.0? What happens if you use map(strip,l) directly? To know More, Read More!