WTF Python

Exploring Python through counter-intuitive snippets. – satwikkansal/wtfpython… Read more

Similar

Python: default argument blunders

A few minutes ago a friend sent me the following code, and told me its misbehaving: def foo(l=[]): l.append("hello!") print(l) foo() foo() Instead of printing ["hello"] twice, it printed ["hello", "hello"]. Any ideas why? what's going on? I'll... (more…)

Read more »

Python support in Visual Studio 2017

Over the last few months, Visual Studio 2017 has been in preview and many of you have been trying it out and providing feedback. We are very appreciative of everyone who has taken the time to do this. As many noticed, during an update in January we remove... (more…)

Read more »

Python’s for Loop Explained

Have you ever thought about how the for loop is implemented in Python? I always thought it would iterate over all elements in the sequence, like it does, but that first it would query the sequence to know its length and then request that many elements. Tu... (more…)

Read more »