[Python-ideas] Make obj[] valid syntax?
Thomas Heller
theller at ctypes.org
Wed Nov 14 19:59:15 CET 2007
Guido van Rossum schrieb:
> 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"?
>
Sure, but this requires to use [] for setting and () for getting the property.
More information about the Python-ideas
mailing list