__slot__ issues

Arthur Siegel ajs at ix.netcom.com
Fri Jul 5 09:41:50 EDT 2002


Eric Texier writes -

>I don't thing it is a bug and I like it like this. I use it, not only to
save
>memory but also to force myself to declare and init all the variables
>instance. When I am there,  editing the __slots__  I can use the time
>to actually set a default value in the __init__. (nasty c++ habit)

What I was pointing to as a bug was the error message under the
circumstances of the 2nd part of my post.  Not anything else related to
the behavior of slots  -  which I am assuming work as designed.

> SystemError: C:\Code\221\Objects\dictobject.c:511: bad argument to
internal
> function

Certainly unlike any error message I've encountered before in Python, and
significant, I would think, if one were trying to catch Attribute Errors
that
one would expect when using slots. I'll probably just send it up as
a bug report.

Tim straightened me out  on tutor - so that I understand now that the
purpose
of slots is memory related.  But like you I am trying to use the facility to
kill a few
birds with one stone.  For my purposes I was hoping to use it to accumulate
a list of  legal keyword arguments for each class. Perhaps something along
the
lines of the  concatenate idea you suggest would work for my purpose. If
not, I'll consider it as something learned and revert to a more standard
approach to solving my issue.


Art







More information about the Python-list mailing list