Re: interfacing Python interpreter with a VB6 frontend

2007-10-03 Thread Steve Holden
Anonymous wrote: Ryan Ginstrom wrote: On Behalf Of Anonymous This requires several steps, but the one I am having most problem finding info on is the ff: 1. using/interacting the Python interpreter from VB6 One way to do this might be by creating a COM server with Python, and having

Re: Reentrancy of Python interpreter

2007-10-01 Thread Brad Johnson
bvukov at yahoo.com writes: Looks like ( from PyThreadStage_Get error ) that you lost the GIL. You probably entered some C++ code and encapsulated you're work in the Py_BEGIN_ALLOW_THREADS code Py_END_ALLOW_THREADS but you're code is calling back the Python function, and you forgot

Re: Reentrancy of Python interpreter

2007-10-01 Thread Hrvoje Niksic
Brad Johnson [EMAIL PROTECTED] writes: I have a place where I execute a Python command that calls into C++ code which then in turn calls back into Python using the same interpreter. I get a fatal error which is PyThreadStage_Get: no current thread. Does the C++ code call into the interpreter

Re: Reentrancy of Python interpreter

2007-10-01 Thread Brad Johnson
: no current thread. Does the C++ code call into the interpreter from a different thread? No. But, problem has been solved. I enabled thread support for the Python interpreter and now wrap the code that caused the problem in PyGILState_Ensure and PyGILState_Release. I'm not sure why

Re: Reentrancy of Python interpreter

2007-09-29 Thread bvukov
On Sep 28, 11:31 pm, Brad Johnson [EMAIL PROTECTED] wrote: I have embedded a single threaded instance of the Python interpreter in my application. I have a place where I execute a Python command that calls into C++ code which then in turn calls back into Python using the same interpreter. I

Reentrancy of Python interpreter

2007-09-28 Thread Brad Johnson
I have embedded a single threaded instance of the Python interpreter in my application. I have a place where I execute a Python command that calls into C++ code which then in turn calls back into Python using the same interpreter. I get a fatal error which is PyThreadStage_Get: no current thread

Re: Embedding the python interpreter

2007-08-30 Thread Tom Gur
On Aug 28, 4:03 pm, Grant Edwards [EMAIL PROTECTED] wrote: On 2007-08-28, Tom Gur [EMAIL PROTECTED] wrote: Hey, Do you know an easy way to embed the python interpreter in a python program (so a non-technical user, which has no idea how to install the python interpreter would be able

Embedding the python interpreter

2007-08-28 Thread Tom Gur
Hey, Do you know an easy way to embed the python interpreter in a python program (so a non-technical user, which has no idea how to install the python interpreter would be able to run the script as an executable) ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding the python interpreter

2007-08-28 Thread Python list
Hi, Do you mean something like py2exe? http://www.py2exe.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding the python interpreter

2007-08-28 Thread penten
On Aug 28, 8:45 pm, Tom Gur [EMAIL PROTECTED] wrote: Hey, Do you know an easy way to embed the python interpreter in a python program (so a non-technical user, which has no idea how to install the python interpreter would be able to run the script as an executable) ? py2exe does this very

Re: Embedding the python interpreter

2007-08-28 Thread Grant Edwards
On 2007-08-28, Tom Gur [EMAIL PROTECTED] wrote: Hey, Do you know an easy way to embed the python interpreter in a python program (so a non-technical user, which has no idea how to install the python interpreter would be able to run the script as an executable) ? Hey, This question is asked

[issue1728488] -q (quiet) option for python interpreter

2007-08-24 Thread Georg Brandl
Changes by Georg Brandl: -- superseder: - -q (quiet) option for python interpreter _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1728488 _ ___ Python-bugs-list

[ python-Feature Requests-1728488 ] -q (quiet) option for python interpreter

2007-08-12 Thread SourceForge.net
of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Closed Resolution: None Priority: 5 Private: No Submitted By: Marcin Wojdyr (wojdyr) Assigned to: Nobody/Anonymous (nobody) Summary: -q (quiet) option for python

[ python-Feature Requests-1728488 ] -q (quiet) option for python interpreter

2007-08-02 Thread SourceForge.net
of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Marcin Wojdyr (wojdyr) Assigned to: Nobody/Anonymous (nobody) Summary: -q (quiet) option for python

condor_compiled python interpreter

2007-07-11 Thread Thomas Nelson
Does anyone know where I could find help on condor_compiling a python interpreter? My own attempts have failed, and I can't find anything on google. Here's the condor page: http://www.cs.wisc.edu/condor/ Thanks, Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: condor_compiled python interpreter

2007-07-11 Thread Will Maier
On Wed, Jul 11, 2007 at 10:28:52AM -0700, Thomas Nelson wrote: Does anyone know where I could find help on condor_compiling a python interpreter? My own attempts have failed, and I can't find anything on google. This is probably more condor-related than Python-related, but are you building

[ python-Feature Requests-1728488 ] -q (quiet) option for python interpreter

2007-05-30 Thread SourceForge.net
for python interpreter Initial Comment: I'd like to suggest the new option for python: -q Do not print the version and copyright messages. These messages are also suppressed in non-interactive mode. Why: I often use python as a calculator, for a couple-lines calculations, and would

Executing Python interpreter from Java

2007-05-21 Thread nadeemabdulhamid
Hello, I'm trying to write some Java code that will launch a python interpreter shell and pipe input/output back and forth from the interpreter's i/o streams and the Java program. The code posted below seems to work just fine under Mac OS X; however, under Windows XP (Java 1.6 and Python 2.5

Re: Using the Python interpreter

2007-04-19 Thread John Zenger
On Apr 18, 8:32 pm, [EMAIL PROTECTED] wrote: Instead of starting IDLE as I normally do, I started the Python interpreter and tried to run a program. I got a Python prompt (), and then tried unsuccessfully to run a Python script named Script1.py that runs perfectly well in IDLE. Here's what I

Using the Python interpreter

2007-04-18 Thread tkpmep
Instead of starting IDLE as I normally do, I started the Python interpreter and tried to run a program. I got a Python prompt (), and then tried unsuccessfully to run a Python script named Script1.py that runs perfectly well in IDLE. Here's what I did: Script1.py Traceback (most recent call last

Re: Using the Python interpreter

2007-04-18 Thread Stevie
On Thu, 19 Apr 2007 01:32:36 +0100, [EMAIL PROTECTED] wrote (in article [EMAIL PROTECTED]): Instead of starting IDLE as I normally do, I started the Python interpreter and tried to run a program. I got a Python prompt (), and then tried unsuccessfully to run a Python script named Script1.py

Re: Using the Python interpreter

2007-04-18 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: Instead of starting IDLE as I normally do, I started the Python interpreter and tried to run a program. I got a Python prompt (), and then tried unsuccessfully to run a Python script named Script1.py that runs perfectly well in IDLE. Here's what I did: Script1.py

questions on dynamically binding the Python interpreter

2007-02-28 Thread has
Hi all, need a little bit of advice on dynamically binding an embedded Python interpreter. First, the code for anyone that wants a look: http://trac.macosforge.org/projects/appscript/browser/py-osacomponent/trunk/PyOSA It's a Python OSA component for OS X. The idea is that you wrap up

New GSM/GPRS board with Python interpreter

2007-02-21 Thread massimo . battisti
Area SX has released a new board based on a GSM/GPRS/GPS engine with embedded Python interpreter. The board features input and output lines, RS232 serial line, debug serial line, backup battery and much more. This board allows you to build a remote SMS or GPRS control or positioning system using

Problem embedding the Python interpreter and importing win32 extensions

2007-01-26 Thread paroutyj
I have been playing around with this issue for a while and seen some previous posting trying to address the problem but I haven't seen any answers to the problem so I am reposting it in my quest for a solution. I am using python 2.2.3, because I am using some dSpace software

Re: Problem embedding the Python interpreter and importing win32extensions

2007-01-26 Thread Gabriel Genellina
[EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] I am using python 2.2.3, because I am using some dSpace software (controldesk/automationdesk) that is based upon that version of python. I have some pre-compiled python modules that come with the dspace applications. I am pretty

Re: Pausing for Python Interpreter error messages...

2007-01-07 Thread redefined . horizons
is when I run this script using the Python interpreter I can't get the command prompt to stay up long enough for me to read the message. How do I get the command prompt to stay up? first open the command prompt, then launch your script from the command prompt. Is there a way to run my

Re: Pausing for Python Interpreter error messages...

2007-01-06 Thread Bruno Desthuilliers
for me. You may want to have a look at the unittest module then: http://docs.python.org/lib/module-unittest.html The only problem is when I run this script using the Python interpreter I can't get the command prompt to stay up long enough for me to read the message. How do I get

Pausing for Python Interpreter error messages...

2007-01-05 Thread redefined . horizons
run this script using the Python interpreter I can't get the command prompt to stay up long enough for me to read the message. How do I get the command prompt to stay up? Is there a way to run my script and view the error message in IDLE? Thanks for the help. Scott Huey P.S. - I'm using Windows

Re: Quake 3 and the Python interpreter

2006-12-15 Thread Mathias Panzenboeck
Neil Toronto wrote: 2) Is there any way to restrict Python modules from accessing files outside of a sandbox? As far as I heard, there is no really working way. But maybe that has changed in python 2.5? Or it will in 3.0? I dunno. -- http://mail.python.org/mailman/listinfo/python-list

Quake 3 and the Python interpreter

2006-12-10 Thread Neil Toronto
So I've recently had a stroke of insanity, deciding that what the open-source Quake III engine *really* needs is a good, healthy dose of Python. Here's the quick version: The Q3 engine is split into the engine (responsible for rendering, sound, networking, input, and collision detection) and

Re: the actual C code - Re: Scoping bugs in an embedded Python interpreter - Wizards please

2006-10-01 Thread morris . slutsky
FOUND IT! http://mail.python.org/pipermail/python-list/1999-June/005833.html So I'm supposed to only have ONE dictionary, 'glb', and forget the 'loc' for locals. Just call PyRun(...glb,glb) Seeing as this was a topic of discussion 7 years ago, maybe it ought to be in the extending and

Scoping bugs in an embedded Python interpreter - Wizards please

2006-09-29 Thread morris . slutsky
in there, I can type interactive commands in there and they get fed into a python interpreter, I can even type stuff like glBegin(gl.LINES); glColor()...glVertex()glEnd() and see stuff appear on the screen, it's really amazing and lots of fun. I am sure that someday I can be calling C functions

Re: Scoping bugs in an embedded Python interpreter - Wizards please

2006-09-29 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: But I'm suffering from serious scoping bugs. I hope someone here can help me with them. First of all, if I type in something like; def f(x): if x==1: return x else: return x * f(x-1) and then go print f(5) I get an

the actual C code - Re: Scoping bugs in an embedded Python interpreter - Wizards please

2006-09-29 Thread morris . slutsky
Fredrik Lundh wrote: [EMAIL PROTECTED] wrote: But I'm suffering from serious scoping bugs. I hope someone here can help me with them. First of all, if I type in something like; def f(x): if x==1: return x else: return x * f(x-1) and

python interpreter on solaris 10

2006-09-25 Thread sam
dear all, having spent the last couple of weeks getting to grips with python on windows, i am in the position of trying to make the transition to my newly arrived ultra 20. however, although there are plenty of files with idle somewhere in the title, idle.py (which i assume is the interpreter)

Re: python interpreter on solaris 10

2006-09-25 Thread sam
to update: i think i've tracked down the equivalent files on my pc. one opens the interpreter in a white-backed text editor, the other at the black-backed command prompt. i have equivalent files of the same size on the workstation, which must be the same. does anyone know why i'm getting 'there

Re: python interpreter on solaris 10

2006-09-25 Thread skip
sam does anyone know why i'm getting 'there is no installed viewer sam capable of displaying the document'? You probably need to associate files having .py file extensions with the Python interpreter. You've given no indication of the environment you're using other than Solaris 10

Re: python interpreter on solaris 10

2006-09-25 Thread casevh
i think i've tracked down the equivalent files on my pc. one opens the interpreter in a white-backed text editor, the other at the black-backed command prompt. i have equivalent files of the same size on the workstation, which must be the same. does anyone know why i'm getting 'there is no

Re: python interpreter on solaris 10

2006-09-25 Thread sam
[EMAIL PROTECTED] wrote: i think i've tracked down the equivalent files on my pc. one opens the interpreter in a white-backed text editor, the other at the black-backed command prompt. i have equivalent files of the same size on the workstation, which must be the same. does anyone know why

Re: python interpreter on solaris 10

2006-09-25 Thread casevh
. any ideas on what i need to choose? You'll need to associate all the python programs (*.py files) with the python interpreter. To my knowledge, all official Solaris releases provide Python 2.3 as /usr/sfw/bin/python. Solaris Express ( stable development snapshots, usually released every two weeks

Re: python interpreter on solaris 10

2006-09-25 Thread sam
I would try to use the python executable located in /usr/bin if it is exists, otherwise use the python executable in /usr/sfw/bin. casevh lordy lord, is that where it was. i just found it now. i had been thinking that idle was the name of the python interpreter, not just the IDE, hence my

Re: python interpreter on solaris 10

2006-09-25 Thread MrJean1
FWIIW, On my stock Ultra 20 / Solaris 10 / Opteron box, python, idle, etc. just run fine provided /usr/sfw/bin is in your PATH environment variable. That is Python 2.3.3, however. In addition, I installed the Python 2.4.3 build for Solaris from ActiveState and python, idle, etc. run without any

Access to sys.argv when python interpreter is invoked in some modes like 'python -c command'

2006-08-20 Thread poggle . themammal
The python tutorial says When the script name is given as '-' (meaning standard input), sys.argv[0] is set to '-'. When -c command is used, sys.argv[0] is set to '-c'. but when we use a command say 'python -c command' where can we access sys.argv (are there some commands where sys.argv is

Re: Access to sys.argv when python interpreter is invoked in some modes like 'python -c command'

2006-08-20 Thread Simon Forman
[EMAIL PROTECTED] wrote: The python tutorial says When the script name is given as '-' (meaning standard input), sys.argv[0] is set to '-'. When -c command is used, sys.argv[0] is set to '-c'. but when we use a command say 'python -c command' where can we access sys.argv (are there some

Memory usage of an 'empty' python interpreter

2006-08-16 Thread neokosmos
I was wondering what the approximate amount of memory needed to load a Python interpreter (only, no objects, no scripts, no nothing else) in a Linux 2.6 environment. According to ps, it appears to be 3312 bytes, which seems absurdly low to me. However, when I check the size of my Python

Re: Memory usage of an 'empty' python interpreter

2006-08-16 Thread Ant
[EMAIL PROTECTED] wrote: I was wondering what the approximate amount of memory needed to load a Python interpreter (only, no objects, no scripts, no nothing else) in a Linux 2.6 environment. According to ps, it appears to be 3312 bytes, which seems absurdly low to me. However, when I check

Re: Memory usage of an 'empty' python interpreter

2006-08-16 Thread Ganesan Rajagopal
neokosmos [EMAIL PROTECTED] writes: I was wondering what the approximate amount of memory needed to load a Python interpreter (only, no objects, no scripts, no nothing else) in a Linux 2.6 environment. According to ps, it appears to be 3312 bytes, which seems absurdly low to me. However

Re: Memory usage of an 'empty' python interpreter

2006-08-16 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: I was wondering what the approximate amount of memory needed to load a Python interpreter (only, no objects, no scripts, no nothing else) in a Linux 2.6 environment. According to ps, it appears to be 3312 bytes, which seems absurdly low to me. Your spidey sense

Re: Memory usage of an 'empty' python interpreter

2006-08-16 Thread John Machin
Ant wrote: [EMAIL PROTECTED] wrote: I was wondering what the approximate amount of memory needed to load a Python interpreter (only, no objects, no scripts, no nothing else) in a Linux 2.6 environment. According to ps, it appears to be 3312 bytes, which seems absurdly low to me

Re: Memory usage of an 'empty' python interpreter

2006-08-16 Thread Ant
Are you sure ps is reporting in bytes not KB? The bare interpreter in Windows is 3368KB. Where did you get that from? With Python 2.4.3, on my machine (Win XP SP2): C:\junkdir \python24\python* [snip] 29/03/2006 05:35 PM 4,608 python.exe 29/03/2006 05:35 PM

Re: Memory usage of an 'empty' python interpreter

2006-08-16 Thread John Machin
Ant wrote: Are you sure ps is reporting in bytes not KB? The bare interpreter in Windows is 3368KB. Where did you get that from? With Python 2.4.3, on my machine (Win XP SP2): C:\junkdir \python24\python* [snip] 29/03/2006 05:35 PM 4,608 python.exe 29/03/2006

python interpreter widget for Tkinter?

2006-04-10 Thread Alexandre Guimond
Hi i was wondering if there already existed a simple python interpreter widget for tkinter? Basically, i would like to be able to lauch a python interpreter in a seperate window from my tkinter app for debugging purposes. I would assume that this would be possible using idlelib, but i can't figure

Re: python interpreter widget for Tkinter?

2006-04-10 Thread Ian Parker
In message [EMAIL PROTECTED], Alexandre Guimond [EMAIL PROTECTED] writes Hi i was wondering if there already existed a simple python interpreter widget for tkinter? Basically, i would like to be able to lauch a python interpreter in a seperate window from my tkinter app for debugging purposes. I

Re: aborting without killing the python interpreter

2006-02-19 Thread Fabrizio Milo
import sys def main(): print 'exiting' sys.exit() try: main() except SystemExit: pass I suspect I may need to use exceptions, but I'm hoping not to need them. Thanks. Use the Exceptions! -- http://mail.python.org/mailman/listinfo/python-list

aborting without killing the python interpreter

2006-02-18 Thread Russ
I wrote a simple little function for exiting with an error message: def error ( message ): print_stack(); exit (\nERROR: + message + \n) It works fine for executing as a script, but when I run it interactively in the python interpreter it kills the interpreter. That's not what I want

Re: aborting without killing the python interpreter

2006-02-18 Thread Terry Reedy
' is bound to the string 'Use Ctrl-Z plus Return to exit.' so trying to call it as a function fails. but when I run it interactively in the python interpreter it kills the interpreter. That's not what I want. Is there a simple way to have a script terminate but not have it kill the python interpreter

Re: aborting without killing the python interpreter

2006-02-18 Thread Terry Reedy
correction Terry Reedy [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How? In the standard interpreter, 'exit' is bound to the string 'Use Ctrl-Z plus Return to exit.' This is, of course, Windows specific. Other systems have other strings. --

Re: aborting without killing the python interpreter

2006-02-18 Thread Erik Max Francis
Terry Reedy wrote: How? In the standard interpreter, 'exit' is bound to the string 'Use Ctrl-Z plus Return to exit.' so trying to call it as a function fails. I'm _presuming_ there was a hidden `from sys import *` in there. Hence calling exit with the string (the help for sys.exit shows

Re: aborting without killing the python interpreter

2006-02-18 Thread Robert Kern
Russ wrote: I wrote a simple little function for exiting with an error message: def error ( message ): print_stack(); exit (\nERROR: + message + \n) It works fine for executing as a script, but when I run it interactively in the python interpreter it kills the interpreter. That's

Re: PYTHON INTERPRETER

2006-01-02 Thread Alex Martelli
Corey Carter [EMAIL PROTECTED] wrote: I am interested in creating programs in python. I am not sure how I would run the programs on other machines without having to install python on each machine. Is there a way to run python programs on machines without the python interpreter

Re: Embedded Python interpreter and sockets

2005-11-22 Thread wahn
Hi Chris, Thanks for your help. I'll try that ... Cheers, Jan -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedded Python interpreter and sockets

2005-11-22 Thread wahn
Hey Chris, I fixed the problem in another way (don't ask me why that works). One detail I didn't talk about is that I use the Boost.Python library. So I just made sure that I load the socket module before I import my own Python script (using that socket module): ... object

Re: Embedded Python interpreter and sockets

2005-11-22 Thread wahn
Hi, actually that didn't solve the problem. As soon as you do something with the socket module it fails. Well, the solution I came up with is simply link the ../_socket.so into my Houdini plugin DSO which is ugly but solves the problem for the moment ... Happy hacking, Jan --

Embedded Python interpreter and sockets

2005-11-18 Thread wahn
Hi, Here is a problem I came across and need some help with. I developed a little Python script with some classes which runs standalone and communicates with a database via sockets. So far everything works fine. I also successfully embedded the Python interpreter into a plugin for a commercial 3D

Re: Embedded Python interpreter and sockets

2005-11-18 Thread [EMAIL PROTECTED]
Hi Jan, I believe the problem lies with how Houdini uses dlopen() to open your plugin. It uses RTLD_LOCAL to load your plugin, which means that all your plugin's symbols (including the python symbols) are private to that library. Subsequent dlopen() calls, including those made by the python

Embedded Python interpreter, runtime libs, and crashing

2005-10-25 Thread Peter Newman
I'm embedding a Python interpreter into a project, and compiling with MSVC. It all runs great in the Debug configuration, but everything gets scary when I switch to Release. I've read about things that can go wrong when you use the wrong runtime library when compiling a program that uses Python

Re: Embedded Python interpreter, runtime libs, and crashing

2005-10-25 Thread jussij
It all runs great in the Debug configuration, but everything gets scary when I switch to Release. My suggestion would be to turn on debug information for the release build. That would at least let you run the release build inside the debugger, allowing you to see the call stack of the

Re: python interpreter

2005-10-13 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], g.franzkowiak wrote: my interest is for the internals of the Python interpreter. I've used up to now FORTH for something and this indirect interpreter is very smart. --- ASM --- NEXT: LODSW

Re: python interpreter

2005-10-13 Thread Neal Norwitz
g.franzkowiak wrote: Hi everybody, my interest is for the internals of the Python interpreter. I've used up to now FORTH for something and this indirect interpreter is very smart. --- ASM --- Where can I find informations like

python interpreter

2005-10-11 Thread g.franzkowiak
Hi everybody, my interest is for the internals of the Python interpreter. I've used up to now FORTH for something and this indirect interpreter is very smart. --- ASM --- NEXT: LODSW ; WA - [IP

Re: python interpreter

2005-10-11 Thread Paul Rubin
g.franzkowiak [EMAIL PROTECTED] writes: Where can I find informations like this for Python ? Use the force, read the source. Python's interpreter is more like a big switch statement on bytecodes, though. -- http://mail.python.org/mailman/listinfo/python-list

Python interpreter bug

2005-10-07 Thread alainpoint
Hello, I came accross what i think is a serious bug in the python interpreter. Membership testing seems not to work for list of objects when these objects have a user-defined __cmp__ method. It is present in Python 2.3 and 2.4. I don't know about other versions. The following code illustrates

Re: Python interpreter bug

2005-10-07 Thread Simon Percivall
Why would it be a bug? You've made it so that every instance of OBJ is equal to every other instance of OBJ. The behaviour is as expected. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python interpreter bug

2005-10-07 Thread Steve Holden
[EMAIL PROTECTED] wrote: Hello, I came accross what i think is a serious bug in the python interpreter. Membership testing seems not to work for list of objects when these objects have a user-defined __cmp__ method. It is present in Python 2.3 and 2.4. I don't know about other versions

Re: Python interpreter bug

2005-10-07 Thread alainpoint
There is definitely a bug. Maybe the follownig snippet is more clear: class OBJ: def __init__(self,identifier): self.id=identifier self.allocated=0 #def __cmp__(self,other): # return cmp(other.allocated,self.allocated) mylist=[OBJ(i)

Re: Python interpreter bug

2005-10-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: I came accross what i think is a serious bug in the python interpreter. Membership testing seems not to work for list of objects when these objects have a user-defined __cmp__ method. it does not work if they have *your* __cmp__ method, no. if you add a print

Re: Python interpreter bug

2005-10-07 Thread alainpoint
Sorry Fredrik but I don't understand. Just comment out the assert and you have different results depending on whether an unrelated sort function is defined. This seems weird to me ! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python interpreter bug

2005-10-07 Thread Steve Holden
[EMAIL PROTECTED] wrote: Sorry Fredrik but I don't understand. Just comment out the assert and you have different results depending on whether an unrelated sort function is defined. This seems weird to me ! Perhaps you don't understand what's going on. The test obj in excluded is

Re: Python interpreter bug

2005-10-07 Thread alainpoint
I understand this, Steve. I thought the _cmp_ method was a helper for sorting purposes. Why is it that a membership test needs to call the __cmp__ method? If this isn't a bug, it is at least unexpected in my eyes. Maybe a candidate for inclusion in the FAQ? Thank you for answering Alain --

Re: Python interpreter bug

2005-10-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: Sorry Fredrik but I don't understand. Just comment out the assert and you have different results depending on whether an unrelated sort function is defined. This seems weird to me ! not if you look at what it prints. (if it seems weird to you that 0 equals 0, it's

Re: Python interpreter bug

2005-10-07 Thread [EMAIL PROTECTED]
Your __cmp__ method will always return 0, so all objects will be equal when you add the method, as Simon and Steve pointed out. The result is all objects will pass the test of being a member of excluded. If you do not add a __cmp__ method objects will be compared on identy - call the id() function

Re: Python interpreter bug

2005-10-07 Thread [EMAIL PROTECTED]
Your __cmp__ method will always return 0, so all objects will be equal when you add the method, as Simon and Steve pointed out. The result is all objects will pass the test of being a member of excluded. If you do not add a __cmp__ method objects will be compared on identy - call the id() function

Re: Python interpreter bug

2005-10-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: Why is it that a membership test needs to call the __cmp__ method? because the membership test has to check if the tested item is a member of the sequence. if it doesn't do that, it's hardly qualifies as a membership test. from the reference manual: For the list

Re: Python interpreter bug

2005-10-07 Thread alainpoint
In fact, i want to sort the list based on the 'allocated attribute' and at the same time, test membership based on the id attribute. __cmp__ logically implies an ordering test, not an identity test. These two notions seems to be confounded in python which is unfortunate. Two objects could have the

Re: Python interpreter bug

2005-10-07 Thread [EMAIL PROTECTED]
For this, you can also define the __eq__ method, which will be preferred to __cmp__ for equallity tests while still using __cmp__ for searching / comparisons. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python interpreter bug

2005-10-07 Thread Carsten Haese
On Fri, 2005-10-07 at 10:33, [EMAIL PROTECTED] wrote: In fact, i want to sort the list based on the 'allocated attribute' and at the same time, test membership based on the id attribute. __cmp__ logically implies an ordering test, not an identity test. These two notions seems to be confounded

Re: Python interpreter bug

2005-10-07 Thread Robert Kern
[EMAIL PROTECTED] wrote: In fact, i want to sort the list based on the 'allocated attribute' and at the same time, test membership based on the id attribute. __cmp__ logically implies an ordering test, not an identity test. These two notions seems to be confounded in python which is

Re: Python interpreter bug

2005-10-07 Thread bruno modulix
[EMAIL PROTECTED] wrote: Sorry Fredrik but I don't understand. Just comment out the assert and you have different results depending on whether an unrelated sort function is defined. This seems weird to me ! code snippet: from random import choice class OBJ: def

Re: Python interpreter bug

2005-10-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: In fact, i want to sort the list based on the 'allocated attribute' and at the same time, test membership based on the id attribute. __cmp__ logically implies an ordering test really? http://dictionary.reference.com/search?q=compare com·pare v. com·pared,

Re: Python interpreter bug

2005-10-07 Thread alainpoint
No doubt you're right but common sense dictates that membership testing would test identity not equality. This is one of the rare occasions where Python defeats my common sense ;-( Alain -- http://mail.python.org/mailman/listinfo/python-list

Re: Python interpreter bug

2005-10-07 Thread Christopher Subich
[EMAIL PROTECTED] wrote: No doubt you're right but common sense dictates that membership testing would test identity not equality. This is one of the rare occasions where Python defeats my common sense But object identity is almost always a fairly ill-defined concept. Consider this (Python

Re: Python interpreter bug

2005-10-07 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: No doubt you're right but common sense dictates that membership testing would test identity not equality. what does common sense have to say about this case: L = (aa, bb, cc, dd) S = a + a L ('aa', 'bb', 'cc', 'dd') S 'aa' S in L # True or False ? /F --

Re: Python interpreter bug

2005-10-07 Thread alainpoint
Steve Holden wrote: Consider: a = {1:'one'} b = {2:'two'} c = {1:'one'} a is c False a in [b, c] True What would you have Python do differently in these circumstances? You mean: What i would do i if i was the benevolent dictator ? I would make a distinction between mutables and

Re: Python interpreter bug

2005-10-07 Thread Steve Holden
[EMAIL PROTECTED] wrote: Steve Holden wrote: Consider: a = {1:'one'} b = {2:'two'} c = {1:'one'} a is c False a in [b, c] True What would you have Python do differently in these circumstances? You mean: What i would do i if i was the benevolent dictator ? I would

Re: Modify a C++ instance from the embed python interpreter

2005-08-28 Thread Wezzy
Diez B. Roggisch [EMAIL PROTECTED] wrote: Wezzy wrote: Hi, is there a tool that automatically expose an object to python? i have an instance of a C++ (or ObjC) object and i want to pass it to the embed interpreter that runs inside my program. Python code have to call c++ method and

Modify a C++ instance from the embed python interpreter

2005-08-27 Thread Wezzy
Hi, is there a tool that automatically expose an object to python? i have an instance of a C++ (or ObjC) object and i want to pass it to the embed interpreter that runs inside my program. Python code have to call c++ method and register some callback. I know that swig helps when python creates

Re: Modify a C++ instance from the embed python interpreter

2005-08-27 Thread Diez B. Roggisch
Wezzy wrote: Hi, is there a tool that automatically expose an object to python? i have an instance of a C++ (or ObjC) object and i want to pass it to the embed interpreter that runs inside my program. Python code have to call c++ method and register some callback. I know that swig helps

Python interpreter error: unsupported operand type(s) for |:

2005-08-11 Thread yaffa
hey folks i get this error: Python interpreter error: unsupported operand type(s) for |: when i run this line of code: for incident in bs('tr', {'bgcolor' : '#ee'} | {'bgcolor' : 'white'} ): any idea what i'm doing wrong here? thanks yaffa -- http://mail.python.org/mailman/listinfo

Re: Python interpreter error: unsupported operand type(s) for |:

2005-08-11 Thread Szabolcs Nagy
you cannot use | with two dict (dict has no .__or__ method) what are you trying to do? -- http://mail.python.org/mailman/listinfo/python-list

<    2   3   4   5   6   7   8   >