4
Zmienne lokalne w funkcjach zagnieżdżonych
Dobra, wytrzymaj ze mną, wiem, że to będzie wyglądać strasznie zagmatwane, ale proszę, pomóż mi zrozumieć, co się dzieje. from functools import partial class Cage(object): def __init__(self, animal): self.animal = animal def gotimes(do_the_petting): do_the_petting() def get_petters(): for animal in ['cow', 'dog', 'cat']: cage = Cage(animal) def pet_function(): print "Mary pets …