[Python-Dev] [Python 2.2 BUG] pickle/cPickle does not find __slots__

john coppola john_coppola_r_s@yahoo.com
Fri, 15 Feb 2002 12:56:50 -0800 (PST)

I'm definitely in preference to slot versus attribute.
But may be we could just use def.

class Foo:
   def a
   def b
   def c
   def somemethod(self):

The distinction being the def statement is "unbound"
so to speak.  humm.... the code is not clear enough.

class Foo:
   slot a
   slot b
   slot c
   def foo():

Better, much better.

class Foo:
   slot a is str
   slot b is float
   slot c is property of float
   def foo(self): pass

I like this.  It reads like sentences.
(remember, 'of' modified property to ensure that the
fget return type would be correct and fset passed in
object would be correct)
I didn't much care for Groucho's notation,
particularly if a slot could have multiple types,
why bother assigning types to it at all. It should
definitely be singular.  One to one.

The concept of slot does not need to be solely related
to attributes within a class.  Why not reserve slots
for a methods, classes within a module, modules
imported within modules.  Then it will be easier to
see the overall picture.  Does the slot pattern relate
to every object in python?  I think it does. That's
when the real benefit comes in.  If python could
utilize this pattern in every aspect, the big
performance boost will occur.

In a strange way slots has made python even more
dynamic than it ever was.  Prior to slots, objects had
a static c structure.  Slots enables variability in
another dimension for the underlying C struct.  On the
outside it looks like python is becoming static, but
what's really going on under the hood is quite the
contrary.  Definitely more burden on the compiler to
build correct references and make the correct

Do You Yahoo!?
Got something to say? Say it better with Yahoo! Video Mail