The unPEP: List-Tuple Unification
sholden at holdenweb.com
Fri Jul 20 19:32:20 CEST 2001
"Raymond Hettinger" <othello at javanet.com> wrote in message
news:3B586A1E.B037349D at javanet.com...
> It looks like types and classes are heading toward unification in 2.2a (oh
> Now, I want to offer an idea that is sure to attract a few flames:
> 1. Give lists an assignable property called 'immutable' which defaults to
> 2. If the property gets set to one (i.e. mylist.immutable=1), then the
> disables future assignments. For example, mylist='three' generates:
> TypeError: object doesn't support item assignment
> 3. Immutable lists can never be converted back to mutable. For example,
> mylist.immutable=0 generates:
> TypeError: immutable objects cannot be changed
> 4. Immutable lists can be copied to mutable lists just like tuples can.
> example, mynewlist=list(mylist) makes a new mutable list.
> 5. If a list is used as a dictionary key, then the immutable property
> gets set to one automatically.
> 6. Deprecate tuples. Simplify the tutorials. Get on with life.
> Hiding behind asbestos,
No asbestos required, but what's tha advantage over
mylist = tuple(mylist)
just-wonderingl-ly y'rs - steve
More information about the Python-list