
Co ten #python
class A:
def _init(self, x):
self.x = x
def pobierzx(self):
return self.x
a = A(10)
print(a.pobierz_x)
Zamiast napisać 10 to wywala: >
O co tu chodzi?
class A:
def _init(self, x):
self.x = x
def pobierzx(self):
return self.x
a = A(10)
print(a.pobierz_x)
Zamiast napisać 10 to wywala: >
O co tu chodzi?
- Najlepsze
- Wszystkie komentarze







print(a.pobierz_x())@mikwiat: isPies = True
( ͡° ͜ʖ ͡°)
if isTrue == true return falsePs. Dobra praktyka jest (nawet dla testu) uzywac angielskiego nazewnicta :)
Adres instancji (obiektu) tej klasy.
>>> class X:... foo = lambda *_,
edit: czy adres metody klasy A dla instancji a?
Python musiałby to wszystko przeliczać wielokrotnie, dlatego kopie funkcji są robione "on demand", a same referencje zachowane. To zwykłe słowniki pod spodem są.