[Tutor] UNSUBSCRIPTABLE?

bob gailer bgailer at gmail.com
Mon Mar 9 00:52:48 CET 2009


Kapsicum wrote:
>
>
> On Mon, Mar 9, 2009 at 1:18 AM, WM. <wferguson1 at socal.rr.com 
> <mailto:wferguson1 at socal.rr.com>> wrote:
>
>     Traceback (most recent call last):
>      File "C:\Python26\TicTacToeD.py", line 165, in <module>
>        main()
>      File "C:\Python26\TicTacToeD.py", line 150, in main
>        DisplayBoard(board)
>      File "C:\Python26\TicTacToeD.py", line 68, in DisplayBoard
>        print "\n\t", board[1], "|", board[2], "|", board[3]
>     TypeError: 'function' object is unsubscriptable
>
>  
> error means the object returned is not of type sequence

No. It means that the object does not have a way to handle []. Many 
objects are subscriptable besides sequences.

dict, set, objects with certain "special methods" e.g., __getitem__

-- 
Bob Gailer
Chapel Hill NC
919-636-4239


More information about the Tutor mailing list