On Jan 25, 8:52 pm, Hexamorph <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > Hexamorph wrote: > >> You mean you want the ability to change for example the + operator > >> for ints to something like calculating the cosine instead of doing > >> addition? > > > Sure. Cosines are a monadic operation and the monadic '+' is a NOP, so > > why shouldn't I define +45 to return cosine of 45, (presuming I needed > > lots of cosines). I'd even let you define your own operators. Lots of > > programmers really liked '++' and '--', for examples. > > Well, OK, the cosine example was badly chosen (it would still be > very wired in terms of common syntax and semantics), but I think you > got my point. Changing internal behaviour mostly causes more trouble > as it's worth. > > In the end, you probably can access the parser to do this.
You'd probably want the change to be limited to a certain scope so that, for example, it doesn't affect imported modules. -- http://mail.python.org/mailman/listinfo/python-list