Override 'and' and 'or'

2007-10-07 Thread Dekker
Is it possible to override 'and' and/or 'or'? I cannot find a special
method for it... __and__ and __rand__ and __or__ and __ror__ are for
binary manipulation... any proposals?

Have marvelous sunday,
Marco

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Override 'and' and 'or'

2007-10-07 Thread Dekker
On 7 Okt., 16:19, Steven D'Aprano <[EMAIL PROTECTED]
cybersource.com.au> wrote:
> On Sun, 07 Oct 2007 13:52:15 +, Dekker wrote:
> > Is it possible to override 'and' and/or 'or'?
>
> Not without hacking the Python source code, in which case what you've got
> is no longer Python.
>
> Why do you want to do so?
>
> --
> Steven.

Well I think it is not possible what I wanted to achieve. By
overriding the "and" and "or" keyword I wanted to return a new object:

SqlValueInt(4) and SqlValueInt(5) --> SqlOpAnd(SqlValueInt(4),
SqlValueInt(5))

This is only possible for: +, -, /, *, >, >=, ...

Well... I have to live with the (binary) __and__, __or__ option and
the user has to write:

SqlValueInt(4) & SqlValueInt(5) --> SqlOpAnd(SqlValueInt(4),
SqlValueInt(5))

Thanks for your input, but __nonzero__ is not of any help in this
case... I want to abuse the "magic" functions for some transformations
and not some evaluation.

Marco

-- 
http://mail.python.org/mailman/listinfo/python-list


Installed Python 3 on Mac OS X Yosemite but its still Python 2.7

2015-03-09 Thread James Dekker
I am currently running OS X Yosemite (10.10.2) on my MacBook Pro... By
default, Apple ships Python 2.7.6 on Yosemite.

Just downloaded and ran this installer for Python 3:

python-3.4.3-macosx10.6.pkg

When I opened up my Terminal and typed in python, this is what came up:

Python 2.7.6 (default, Sep  9 2014, 15:04:36) [GCC 4.2.1 Compatible
Apple LLVM 6.0 (clang-600.0.39)] on darwinType "help", "copyright",
"credits" or "license" for more information.>>>

Sorry, I am very new to Python...

Question(s):

(1) Does anyone know where the Python 3.4.3 interpreter was installed?

(2) Do I need to uninstall Python 2.7.3 (if so, how do I go about doing
this) before setting a global environmental variable such as PYTHON_HOME to
the location of the installed Python 3.4.3?

Thank for taking the time to read this...
-- 
https://mail.python.org/mailman/listinfo/python-list