[Python-ideas] Make obj[] valid syntax?

Guido van Rossum guido at python.org
Wed Nov 14 19:45:06 CET 2007


On Nov 14, 2007 10:37 AM, Thomas Heller <theller at ctypes.org> wrote:
> Guido van Rossum schrieb:
> > Why can't you use call syntax, i.e. obj.prop(1, 2, 3)?
>
> Because I cannot set the property in this way:
>
> obj.prop(1, 2, 3) = "foo"
>
> Of course I know that obj.set_prop(1, 2, 3, "foo") would work.

And can't you arrange for obj.prop = "foo" to work as well as
obj.prop[1,2,3] = "foo"?

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-ideas mailing list