[BangPypers] Object Oriented Programming in python

Noufal Ibrahim noufal at nibrahim.net.in
Mon Oct 21 08:02:17 CEST 2013

Saager Mhatre <saager.mhatre at gmail.com> writes:


> Ah, that explains so much. I've always been confused about slots and
> the documentation almost always added to it. Does this mean that once
> you drop to slots, you also lose the descriptor- based dispatch magic?
> That would make this a pretty desperate hack for some last resort
> memory conservation!

I don't know if you lose descriptors. I've never really used __slots__
myself since I've not run into memory tight situations like the ones for
which __slots__ was made for. I have run Python on a usb webcam but I
don't do fancy OO there. I just use raw functions and things like the
array[1] and struct[2] modules to make sure that I have some handle on
how much memory I'm using.

I don't think it's particularly neat which is probably why, as you
mentioned in your original email, it's obscure. It's the final frontier
beyond which space lies (sorry).

[1]  http://docs.python.org/2/library/array.html
[2]  http://docs.python.org/2/library/struct.html


More information about the BangPypers mailing list