
http://vsbabu.org/mt/archives/2003/04/08/pywife.html which I happened to have come across when looking at what is doing in the realm of .Net and Python interoperability. The PyHusband being author of Kobra - a effort in that direction. I understand that Python.Net is not itself in the cards for the time being. But other forms of interoperability seem to be possible, and there are a few projects underway. PyMyWife - extending My(paricular)Wife to interoperate with Python - happens also to not be in the cards. We stay together for the kid. Art

When I think of operators, I think of binary and unary operators like * + / ** or ~ - but not of other syntax, like parentheses or square brackets, as in p() and p[]. However in Python we're able to define new meanings for these other kinds of syntax as well:
class Foo(object): def __getattribute__(self,attr): return "Bar!" def __getitem__(self,it): return "Blimey!" def __call__(self,var): return "Hello?"
p = Foo()
p.spam 'Bar!' p(3) 'Hello?' p['3'] 'Blimey!'
So do we call it "operator overriding" in all these cases, or do some people say "syntax overriding" or something else that sounds more general than "operator". Kirby PS: given the above class def, when I go
p( # <--- just an opening paren in IDLE, it prompts with "Bar!". Not sure why.

On Fri, 27 Jun 2003 11:08:17 -0700 "Kirby Urner" <urnerk@qwest.net> wrote:
When I think of operators, I think of binary and unary operators like * + / ** or ~ - but not of other syntax, like parentheses or square brackets, as in p() and p[].
Yes me too, until i needed to teach it. I wanted to look at how python reads the code and makes a tree from that, so we investigated operator precedence and if you look at the table these funky operators are there aswell, although perhaps more intimately tied up with the parse tree than the usual infix guys. Simon. -- Simon Burton, B.Sc. Licensed PO Box A66 ANU Canberra 2601 Australia Ph. 02 6249 6940 \ ------------------------\ ------------------------/ http://arrowtheory.com /
participants (3)
-
Arthur
-
Kirby Urner
-
Simon Burton