On Feb 8, 7:02 am, Dave Benjamin [EMAIL PROTECTED] wrote:
Neil Cerutti wrote:
There's been only one (or two?) languages in history that
attempted to provide programmers with the ability to implement
new infix operators, including defining precedence level and
associativity (I can't think
[EMAIL PROTECTED] writes:
Also some flavours of Prolog, as descrived in the classic book by
op/3 is part of the Prolog ISO standard:
http://pauillac.inria.fr/~deransar/prolog/bips.html#operators
so every compliant implementation has it.
--
http://mail.python.org/mailman/listinfo/python-list
Neil Cerutti wrote:
There's been only one (or two?) languages in history that
attempted to provide programmers with the ability to implement
new infix operators, including defining precedence level and
associativity (I can't think of the name right now).
You're probably thinking of SML or
Dave Benjamin wrote:
Neil Cerutti wrote:
There's been only one (or two?) languages in history that
attempted to provide programmers with the ability to implement
new infix operators, including defining precedence level and
associativity (I can't think of the name right now).
You're
On 2007-02-02, Ben Finney [EMAIL PROTECTED] wrote:
James Stroud [EMAIL PROTECTED] writes:
Ben Finney wrote:
The Python runtime parser is designed to parse Python, not
some arbitrary language that someone chooses to implement in
Python.
You haven't addressed why the limitation isn't
James Stroud wrote:
You haven't addressed why the limitation isn't arbitrary.
It's not arbitrary because there is a built-in meaning
for infix minus, but not for infix tilde.
Python doesn't go out of its way to provide operators
which aren't used by at least one built-in type.
--
Greg
--
I am trying to overload the __invert__ operator (~) such that
it can take a second argument, other than
self, so that I can express:
x ~ y
by using:
def __invert__(self, other): do something
for example. Is this possible?
Thanks in advance,
--
Chris wrote:
I am trying to overload the __invert__ operator (~) such that
it can take a second argument, other than
self, so that I can express:
x ~ y
by using:
def __invert__(self, other): do something
for example. Is this possible?
No, you will get a syntax error before python
Peter Otten:
No, you will get a syntax error before python even look up the names:
There are some tricks that allow the use of undefined symbols in
Python too, but they are probably just toys. I have recently posted a
recipe in the cookbook for that.
Bye,
bearophile
--
Peter Otten wrote:
Chris wrote:
I am trying to overload the __invert__ operator (~) such that
it can take a second argument, other than
self, so that I can express:
x ~ y
by using:
def __invert__(self, other): do something
for example. Is this possible?
No, you will get a syntax
James Stroud [EMAIL PROTECTED] writes:
Peter Otten wrote:
Chris wrote:
I am trying to overload the __invert__ operator (~) such that it
can take a second argument,
x ~ x
File stdin, line 1
x ~ x
^
SyntaxError: invalid syntax
Seems an arbitrary limitation. Consider
Ben Finney wrote:
James Stroud [EMAIL PROTECTED] writes:
Peter Otten wrote:
Chris wrote:
I am trying to overload the __invert__ operator (~) such that it
can take a second argument,
x ~ x
File stdin, line 1
x ~ x
^
SyntaxError: invalid syntax
Seems an arbitrary limitation.
On Feb 2, 12:49 am, James Stroud [EMAIL PROTECTED] wrote:
Ben Finney wrote:
The Python runtime parser is designed to parse Python, not some
arbitrary language that someone chooses to implement in Python.
You haven't addressed why the limitation isn't arbitrary.
Indeed, and that's because
James Stroud [EMAIL PROTECTED] writes:
Ben Finney wrote:
The Python runtime parser is designed to parse Python, not some
arbitrary language that someone chooses to implement in Python.
You haven't addressed why the limitation isn't arbitrary.
Good thing I wasn't trying to do that, then. I
14 matches
Mail list logo