<[EMAIL PROTECTED]> wrote:
> I do not think I am understanding how to redefine the getitem function
> for string. Why does the following not work:
>
> class NStr(str):
> def __getitem__(self,idx):
> print "NStr:getitem",idx,type(idx)
> return str.__getitem__(self,idx)
>
> s=N
On 21 Apr 2007 20:36:13 -0700, tsm8015 wrote
> I do not think I am understanding how to redefine the getitem
> function for string. Why does the following not work:
>
> class NStr(str):
> def __getitem__(self,idx):
> print "NStr:getitem",idx,type(idx)
> return str.__getitem__(
Hi!
Same result, with Python 2.5.1 on win-XP;
I have compassion with you.
--
@-salutations
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
I do not think I am understanding how to redefine the getitem function
for string. Why does the following not work:
class NStr(str):
def __getitem__(self,idx):
print "NStr:getitem",idx,type(idx)
return str.__getitem__(self,idx)
s=NStr("abcde")
print s[1]
print s[1:4:2]
print