[ python-Bugs-1739107 ] Bug assigning list comprehension to __slots__ in python 2.5

SourceForge.net noreply at sourceforge.net
Mon Jun 18 16:32:28 CEST 2007


Bugs item #1739107, was opened at 2007-06-18 10:32
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1739107&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: François Desloges (fdesloges)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug assigning list comprehension to __slots__ in python 2.5

Initial Comment:
I use the package 2.5-4.1mdv2007.1.i586 in mandriva.
I don't know if this has already been reported elsewhere but the following code:

  a= ['C','D']
  class A(object):
    __slots__ = a + ['__'+name for name in a]
    def __init(self, c, d):
      self.__C = c
      self.__D = d
    C = property(lambda self: self.__C)
    D = property(lambda self: self.__D)
  a = A()

results is an a.name attribute with value 'D'.

But using :

  b= tuple('C','D')
  class B(object):
    __slots__ = b + tuple('__'+name for name in b)
    def __init(self, c, d):
      self.__C = c
      self.__D = d
    C = property(lambda self: self.__C)
    D = property(lambda self: self.__D)
  b = B()

b appropriately do not have a b.name attribute.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1739107&group_id=5470


More information about the Python-bugs-list mailing list