[Python-bugs-list] [ python-Bugs-496240 ] __slots__ does not iterate over a string

noreply@sourceforge.net noreply@sourceforge.net
Fri, 28 Dec 2001 13:57:06 -0800


Bugs item #496240, was opened at 2001-12-22 23:06
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=496240&group_id=5470

Category: Type/class unification
Group: Python 2.2
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Clarence Gardner (cgardner)
Assigned to: Guido van Rossum (gvanrossum)
Summary: __slots__ does not iterate over a string

Initial Comment:
According to Guido's writeup, the value given to
__slots__
can be any iterable object.  If you give it a string
value,
however, e.g. __slots__ = 'abc', instead of getting
three
valid attributes named 'a', 'b', and 'c', you get one
named 'abc'.

Priority: Low. No, even lower :)

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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-28 13:57

Message:
Logged In: YES 
user_id=6380

It's a feature!

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

Comment By: Tim Peters (tim_one)
Date: 2001-12-22 23:17

Message:
Logged In: YES 
user_id=31435

Heh.  For a reason I can't guess, the implementation goes 
out of its way to special-case a bare string.  However, 
Guido's writeup also says "the effect of using something 
that's not a list renders the meaning of your program 
undefined", and getting one attribute named 'abc' is the 
very definition of undefinedness <wink>.

Assigned to Guido.

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

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