More weird observations: the following code does not work until you
change the name of the member 'longer' to a one-char name, for example,
'j':


--- START ---
#!/usr/bin/env python

import copy


class Foo (object):
  __slots__ = 'i'


class Bar (Foo):
  __slots__ = 'longer'
  #__slots__ = 'j'


b1 = Bar()
b1.longer = 22
#b1.j = 22

b2 = copy.copy(b1)


# doesn't work in Python 2.4.2
# BUT if 'longer' is changed to 'j' in the entire file, then it works!
print b2.longer
#print b2.j

--- END ---


I've tried different names and concluded that as long as I used one
character the code works. Anything longer than one character bombs.

Why?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to