[Tutor] tuple & object's attributes (changed)

Alan Gauld alan.gauld at btinternet.com
Sat Jan 3 00:26:07 CET 2009


"Kent Johnson" <kent37 at tds.net> wrote

> To actually *constrain* a collection to be homogeneous seems 
> extremely
> un-pythonic. In actual fact all containers can hold whatever you 
> want
> to put in them without restriction (except hashability requirements
> for sets and dict keys).

And strings which are kind of a collection but only hold characters...

Personally I like to think of Python collections as being like 
Smalltalk
or ObjectiveC collections. They hold objects. And since everything is
a subclass of object they hold anything... It doesn't work completely
but it mostly keeps me sane... :-)

But it does mean that anything more fine grained than object is
down to the programmer.

Alan G. 




More information about the Tutor mailing list