[IronPython] Beta 9 __getitem__

Giles Thomas giles.thomas at resolversystems.com
Thu Jul 13 12:55:48 CEST 2006


Hi,

We've found what looks like a difference between IronPython and 
CPython's parsing of argument lists for square brackets.  This is a 
change from Beta 8, which behaved in the same way as CPython.

CPython:
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> class GetItemTest(object):
...     def __getitem__(self, key):
...         return key
...
 >>> m = GetItemTest()
 >>> print m[8,6]
(8, 6)
 >>>


IronPython:
IronPython 1.0.2385 (Beta) on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
 >>> class GetItemTest(object):
...     def __getitem__(self, key):
...         return key
...
 >>> m = GetItemTest()
 >>> print m[8,6]
Traceback (most recent call last):
  File , line 0, in <stdin>##16
TypeError: __getitem__() takes exactly 2 arguments (3 given)
 >>>


Regards,

Giles

-- 
Giles Thomas
Resolver Systems
giles.thomas at resolversystems.com




More information about the Ironpython-users mailing list