list Integer indexing dies??

Steven Bethard steven.bethard at gmail.com
Thu Dec 23 17:58:51 CET 2004


Ishwor wrote:
> On Thu, 23 Dec 2004 13:33:16 -0300, Batista, Facundo
> <FBatista at unifon.com.ar> wrote:
> 
>>
>>[Ishwor] 
>>
>>#- > What should 035[0] cough up? Be carefull it should 
>>#- 
>>#- >>>035[0] 
>>#- 3 # my own opinion. 
>>#- 
>>#- > cough up the same as 29[0]. 
>>#- 
>>#- >>>29[0] 
>>#- 2 #again my own opinion 
>>
>>Be aware that: 
>>
>>
>>>>>035 == 29 
>>
>>True 
>>
> 
> Yup. Octal variation of 29. But that wasn't my point.

Yes, but worse yet:

py> 035 is 29
True

So 035 and 29 refer to exactly the same object.  They're just syntactic 
variants.  So how's Python to know which syntactic variant you want the 
index taken from?  AFAIK that information is not stored in a Python int 
or you wouldn't get results like:

py> 035
29

Steve



More information about the Python-list mailing list