range question, compared to Smalltalk

Dan Bishop danb_83 at yahoo.com
Wed Aug 28 05:25:57 CEST 2002

Frank Buss <fb at frank-buss.de> wrote in message news:<akgt89$512$1 at newsreader2.netcologne.de>...
> What I mean: Is there any reason, why one shouldn't derive a class from 
> the list-class (perhaps called 'interval'), which behaves like a list, but 
> has only 2 attributes: start and end value.

You could do that, but it would be simpler to just use xrange.

> BTW: is there a way to re-define the builtin range?

Yes.  Just use "range = xrange".
> Another question: Why isn't it possible to get attributes from ints, but 
> from strings?

It IS possible.

>>> (4).__class__
<type 'int'>

More information about the Python-list mailing list