On Sun, 07 Aug 2005 21:41:33 -0400, Nicolas Fleury <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote: [...] >> But here the problem is not in the __getitem__ method: >> >> >>> c.__getitem__(kw='key word arg') >> (<__main__.C object at 0x02EF498C>, (), {'kw': 'key word arg'}) >> >> It's just that square bracket expression trailer syntax does not >> allow the same arg list syntax as parenthesis calling trailer syntax. > >I totally agree and that's what I mean. The formulation of the PEP is >wrong, I should almost not talk about __getitem__ since as you said it >can have any signature. The PEP is about extending [] syntax to call >automtically __getitem__ function with more complex signatures. > >>> Should other operators that square brackets be used for >>> specialization? >> >> Didn't quite parse that ;-) You mean list comprehensions? Or ?? > >I mean should angle brackets <> like in C++, or another operator, be >used instead? I am getting the feeling that your PEP is about a means to do something C++-like in python, not necessarily to enhance python ;-) IOW, it seems like you want the [<new syntax>] to do something like C++ <type_spec> in templates? (BTW, I have nothing against giving python new capabilities (quite the reverse), but not by grafting limbs from other animals ;-) Maybe you want hidden name-mangling of function defs according to arg types and corresponding dispatching of calls? I am afraid I am still not clear on the fundamental motivation for all this ;-) > >Regards and thx for your feedback, You're welcome. Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list