list Integer indexing dies??

Stephen Thorne stephen.thorne at gmail.com
Fri Dec 24 00:29:22 CET 2004


On Fri, 24 Dec 2004 02:59:40 +1030, Ishwor <ishwor.gurung at gmail.com> wrote:

> >>> 123[0] + 2
> 3
TypeError: unsubscriptable object

> > > in which basically python can infer from the object type and print out
> > > 1 instead of coughing up those errors?
> >
> > Why do you feel it should cough up 1?
> >
> 
> >>>123232[0] #hypothetical 0th position in the integer.
> 1
TypeError: unsubscriptable object

> > Suppose I write a number in octal notation.
> >
> > What should 035[0] cough up? Be carefull it should
> 
> >>>035[0]
> 3 # my own opinion.
TypeError: unsubscriptable object

> > cough up the same as 29[0].
> 
> >>>29[0]
> 2 #again my own opinion
TypeError: unsubscriptable object


Just-in-my-own-opinion-ly y'rs

Stephen Thorne



More information about the Python-list mailing list