On Sep 26, 7:43 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 26 Sep 2008 14:54:36 -0700, Carl Banks wrote: > > However, it seems from the rest of your comments that speed is your main > > concern. Last time someone reported __slots__ didn't make a big > > difference in access time, but it probably would speed up creating > > objects a bit. > > Carl probably knows this already, but for the benefit of the Original > Poster: > > __slots__ is intended as a memory optimization, not speed optimization. > If it speeds up creation, that's a serendipitous side-effect of using > less memory.
No, it'd be a serendipitous side-effect of not having to take the time to create a dict object, which is quite a bit more of a direct cause. It might still end up being slower (creating slot descriptors might take more time for all I know) but it's more than just an effect of less memory. Carl Banks -- http://mail.python.org/mailman/listinfo/python-list