Advanced Python or Understanding Python
Why Stack Overflow recommends it
Stack Overflow users link it as a study resource for how Python really works, and cite specific moments in it when asking or answering questions about language semantics.
Recommended by 1 people across 2 different months, 2009 to 2017.
What it is
A 2007 Google Tech Talk by Thomas Wouters aimed at programmers coming to Python from C++ or Java. It covers duck typing, interfaces, descriptors, decorators, metaclasses, reference counting, the cyclic garbage collector and how CPython works under the hood.
What people said
Recommends miku · 2009-05 · Stack Overflow · on “How does a virtual machine work?”
To answer a part of your questions, I'd recommend a google tech talk about python [this video] , where some of your questions concerning dynamic languages are answered; for example what a variable is (it is not a pointer, nor a reference, but in case of python a label).
Recommends miku · 2009-12 · Stack Overflow · on “How to become a good Python coder?”
Write code Read books, [LINK] Read code Read tutorials, [LINK] , ... Write more code Do exercises, e.g. Building Skills in Python [LINK] Write even more code Answer SO python questions, [LINK] Check (your) code regularly, [LINK] Watch talks and presentations: Easy AI in python [LINK] , Advanced python or understanding Python [this video] , [LINK] , ...
Cites miku · 2010-06 · Stack Overflow · on “Assigning IDs to instances of a class (Pythonic)”
The following approach would be relatively pythonic (for my subjective judgement of pythonic - explicit, yet concise): class CounterExample(object): instances_created = 0 def __init__(self): CounterExample.instances_created += 1 def __del__(self): """ If you want to track the current number of instances you can add a hook in __del__. Otherwise use __init__ and just count up. """ CounterExample.instances_created -= 1 If you are facing a large number of classes, which need that kind of attribute, you could also consider writing a metaclass for that. An example of a metaclass: [this video] .
Cites rxmnnxfpvg · 2010-12 · Stack Overflow · on “and / or operators return value”
I was watching a 2007 video on Advanced Python or Understanding Python [this video] , and at 18'27" the speaker claims "As some may know in Python and and or return one of the two values, whereas not returns always a boolean." When has this been the case? As far as I can tell, and and or return booleans, too.
Cites Ivan Pereira · 2017-04 · Stack Overflow · on “Python staticmethod and dependency injection”
Can someone help me with a good explanation on why a staticmethod on python is useful for dependency injection? I was seeing this great video [this video] and on 45m45s Thomas Wouters claim that staticmethods are useful for DI, but I can't grasp why. ... After start to writing this post, and made some tests I think I got it. An example: class GreetPrint(object): def pp(self, param): print("Hello", param) class User(object): def __init__(self, param): self.param = param def print_user(self): self.output(self.param) @staticmethod def output(msg): return print_dependency.pp(msg) print_dependency = GreetPrint() a = User("Guido") a.print_user() This is a better approach (at least in Python) than injec