Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Steven D'Aprano
On Mon, 26 Jul 2010 00:36:47 -0400, Edward Diener wrote: > On 7/25/2010 10:42 PM, David Robinow wrote: [...] >> Edward, I'm having a really hard time understanding your problem. Could >> you give an example of some real code that is causing you difficulty? > > I start a Python script for version

Undo-Redo, copy instance, custom events and a problem

2010-07-25 Thread King
Hi, I am developing an app using wxPython. The Undo-Redo implementation is based on storing pre & post state of an attribute. You store the instance before changing the value and store the instance after changing the values. While undoing or redoing, you copy/replace the current state with stored o

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 10:42 PM, David Robinow wrote: On Sun, Jul 25, 2010 at 8:40 PM, Edward Diener wrote: On 7/25/2010 5:57 PM, Thomas Jollans wrote: So if a standard library module ( or distributed library ) executes a call internally to 'python xxx yyy' or executes a call internally to 'someScript.p

Re: Unicode error

2010-07-25 Thread Nobody
On Sun, 25 Jul 2010 14:47:11 +, Steven D'Aprano wrote: >>> But in the >>> meanwhile, once you get an error, you know what it is. You can >>> intentionally feed code bad data and see what you get. And then maybe >>> add a test to make sure your code traps such errors. >> >> That doesn't really

Re: obtaining pid of child process

2010-07-25 Thread Chris Rebert
On Sun, Jul 25, 2010 at 9:02 PM, tazimk wrote: > Hi, > > I am using python's multiprocessing module to spawn new process > > as follows : > > import multiprocessing > import os > d = multiprocessing.Process(target=os.system,args=('iostat 2 > > a.txt',)) > d.start() > > I want to obtain pid of iost

obtaining pid of child process

2010-07-25 Thread tazimk
Hi, I am using python's multiprocessing module to spawn new process as follows : import multiprocessing import os d = multiprocessing.Process(target=os.system,args=('iostat 2 > a.txt',)) d.start() I want to obtain pid of iostat command or the command executed using multiprocessing module Whe

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-25 Thread Michele Simionato
Everything you ever wanted to know about super is collected here: http://micheles.googlecode.com/hg/artima/python/super.pdf M.S. -- http://mail.python.org/mailman/listinfo/python-list

Re: why is this group being spammed?

2010-07-25 Thread Benjamin Kaplan
Python-list is comp.lang.python turned into mailing list form. gmane is python-list turned back into a newsgroup. The reason it gets less spam is because it's behind the mailing list's spam filters. Both the mailing list and gmane should see the same amount of spam. which is way less than the origi

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 8:41 PM, Steven D'Aprano wrote: On Sun, 25 Jul 2010 15:19:53 -0400, Edward Diener wrote: On 7/25/2010 10:03 AM, Thomas Jollans wrote: On 07/25/2010 02:46 PM, Edward Diener wrote: The problem with this is that you forget that a script can invoke Python internally. So whether one u

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread David Robinow
On Sun, Jul 25, 2010 at 8:40 PM, Edward Diener wrote: > On 7/25/2010 5:57 PM, Thomas Jollans wrote: > So if a standard library module ( or distributed library ) executes a call > internally to 'python xxx yyy' or executes a call internally to > 'someScript.py yyy', you're fine with multiple co-exi

Re: Light-weight/very-simple version control under Windows using Python?

2010-07-25 Thread Ben Finney
"Günther Dietrich" writes: > pyt...@bdurham.com wrote: > > >I have some very simple use cases[1] for adding some version control > >capabilities to a product I'm working on. […] > >I'm looking for recommendations on possible solutions: > > > >1. Use an existing version control utility. […] > Us

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Steven D'Aprano
On Sun, 25 Jul 2010 15:19:53 -0400, Edward Diener wrote: > On 7/25/2010 10:03 AM, Thomas Jollans wrote: >> On 07/25/2010 02:46 PM, Edward Diener wrote: >>> The problem with this is that you forget that a script can invoke >>> Python internally. So whether one uses the console or file association >

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 5:57 PM, Thomas Jollans wrote: On 07/25/2010 11:10 PM, Edward Diener wrote: On 7/25/2010 3:39 PM, Christian Heimes wrote: Am 25.07.2010 21:32, schrieb Thomas Jollans: If a script uses sys.executable instead of "python", there is no problem, at all. It's true that sys.executable

Re: Python acting weird

2010-07-25 Thread Chris Rebert
On Sun, Jul 25, 2010 at 5:08 PM, Westly Ward wrote: > x = {"type":"folder", "name":"sonicbot", "data":[{"type":"folder", > "name":"SonicMail", "data":[{"type":"file", "name":"bbcode.py", > "compressed":False, "contents":"blahblahfilecontents"}]}]} > print x > def setindict(dictionary, keys, value)

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-25 Thread Gregory Ewing
Raymond Hettinger wrote: Every class in the MRO implementing the target method *must* call super() to give the next class in the MRO a chance to run. EXCEPT for the last one, which must NOT call super! The posted example happens to work because object has a default __init__ method that does no

Python acting weird

2010-07-25 Thread Westly Ward
x = {"type":"folder", "name":"sonicbot", "data":[{"type":"folder", "name":"SonicMail", "data":[{"type":"file", "name":"bbcode.py", "compressed":False, "contents":"blahblahfilecontents"}]}]} print x def setindict(dictionary, keys, value) : if len(keys) == 1 : if keys[0].isdigit() and int

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-25 Thread David Cournapeau
On Mon, Jul 26, 2010 at 3:07 AM, Zooko O'Whielacronx wrote: > > I would suggest that people try to build their native extension > modules with mingw, and if it doesn't work report a bug (to mingw > project and to the Python project) so that we can track more precisely > what the issues are. To b

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Thomas Jollans
On 07/25/2010 11:10 PM, Edward Diener wrote: > On 7/25/2010 3:39 PM, Christian Heimes wrote: >> Am 25.07.2010 21:32, schrieb Thomas Jollans: >>> If a script uses sys.executable instead of "python", there is no >>> problem, at all. >> >> It's true that sys.executable is the best way if you have to s

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 4:26 PM, News123 wrote: On 07/25/2010 10:18 PM, Thomas Jollans wrote: On 07/25/2010 10:04 PM, News123 wrote: sOn 07/25/2010 09:39 PM, Christian Heimes wrote: Am 25.07.2010 21:32, schrieb Thomas Jollans: If a script uses sys.executable instead of "python", there is no problem, at

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 4:22 PM, News123 wrote: On 07/25/2010 09:33 PM, Edward Diener wrote: On 7/25/2010 10:31 AM, News123 wrote: On 07/25/2010 02:46 PM, Edward Diener wrote: On 7/25/2010 6:07 AM, Gelonida wrote: How does a 'pystarter' program know where the file's location is which is being invoked

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 3:39 PM, Christian Heimes wrote: Am 25.07.2010 21:32, schrieb Thomas Jollans: If a script uses sys.executable instead of "python", there is no problem, at all. It's true that sys.executable is the best way if you have to start a new Python interpreter. However sys.executable may n

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 3:32 PM, Thomas Jollans wrote: On 07/25/2010 09:19 PM, Edward Diener wrote: On 7/25/2010 10:03 AM, Thomas Jollans wrote: On 07/25/2010 02:46 PM, Edward Diener wrote: The problem with this is that you forget that a script can invoke Python internally. So whether one uses the consol

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread MRAB
News123 wrote: On 07/25/2010 09:33 PM, Edward Diener wrote: On 7/25/2010 10:31 AM, News123 wrote: On 07/25/2010 02:46 PM, Edward Diener wrote: On 7/25/2010 6:07 AM, Gelonida wrote: How does a 'pystarter' program know where the file's location is which is being invoked ? the file's locatio

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread News123
On 07/25/2010 10:18 PM, Thomas Jollans wrote: > On 07/25/2010 10:04 PM, News123 wrote: >> sOn 07/25/2010 09:39 PM, Christian Heimes wrote: >>> Am 25.07.2010 21:32, schrieb Thomas Jollans: If a script uses sys.executable instead of "python", there is no problem, at all. >> >> >> sys.execut

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread News123
On 07/25/2010 09:33 PM, Edward Diener wrote: > On 7/25/2010 10:31 AM, News123 wrote: >> On 07/25/2010 02:46 PM, Edward Diener wrote: >>> On 7/25/2010 6:07 AM, Gelonida wrote: > > How does a 'pystarter' program know where the file's location is which > is being invoked ? the file's location would

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Thomas Jollans
On 07/25/2010 10:04 PM, News123 wrote: > sOn 07/25/2010 09:39 PM, Christian Heimes wrote: >> Am 25.07.2010 21:32, schrieb Thomas Jollans: >>> If a script uses sys.executable instead of "python", there is no >>> problem, at all. > > > sys.executable will not work with scripts converted with py2e

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread News123
sOn 07/25/2010 09:39 PM, Christian Heimes wrote: > Am 25.07.2010 21:32, schrieb Thomas Jollans: >> If a script uses sys.executable instead of "python", there is no >> problem, at all. sys.executable will not work with scripts converted with py2exe, as sys.executable will not be the executable o

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Thomas Jollans
On 07/25/2010 09:39 PM, Christian Heimes wrote: > Am 25.07.2010 21:32, schrieb Thomas Jollans: >> If a script uses sys.executable instead of "python", there is no >> problem, at all. > > It's true that sys.executable is the best way if you have to start a new > Python interpreter. However sys.exec

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Christian Heimes
Am 25.07.2010 21:32, schrieb Thomas Jollans: > If a script uses sys.executable instead of "python", there is no > problem, at all. It's true that sys.executable is the best way if you have to start a new Python interpreter. However sys.executable may not be set for NT services. So there may be a p

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 10:31 AM, News123 wrote: On 07/25/2010 02:46 PM, Edward Diener wrote: On 7/25/2010 6:07 AM, Gelonida wrote: There the windows solution could be something like a small 'pystarter' program, which would decide depending on the file's location / the file's first line which python sho

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Thomas Jollans
On 07/25/2010 09:19 PM, Edward Diener wrote: > On 7/25/2010 10:03 AM, Thomas Jollans wrote: >> On 07/25/2010 02:46 PM, Edward Diener wrote: >>> The problem with this is that you forget that a script can invoke Python >>> internally. So whether one uses the console or file association method >>> of

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Thomas Jollans
On 07/25/2010 09:12 PM, Edward Diener wrote: > On 7/25/2010 1:51 PM, Joel Goldstick wrote: >> There is this: >> http://pypi.python.org/pypi/virtualenv > > It appears to be only for Linux. I don't know where you get that impression from. I don't know how well it works on which platforms, but the f

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 10:03 AM, Thomas Jollans wrote: On 07/25/2010 02:46 PM, Edward Diener wrote: The problem with this is that you forget that a script can invoke Python internally. So whether one uses the console or file association method of invoking Python externally, any already written script can

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 1:51 PM, Joel Goldstick wrote: Edward Diener wrote: Are there any documents about multiple versionsof Python coexisting in the same OS ( Windows in my case ) and what pitfalls to look out for ? I have already run into a number of them. I installed Python 2.7 and 3.1.2 into completel

Re: Light-weight/very-simple version control under Windows using Python?

2010-07-25 Thread Günther Dietrich
pyt...@bdurham.com wrote: >I have some very simple use cases[1] for adding some version control >capabilities to a product I'm working on. My product uses simple, text >(UTF-8) based scripts that are independent of one another. I would like >to "version control" these scripts on behalf of my users

Re: Download Microsoft C/C++ compiler for use with Python 2.6/2.7 ASAP

2010-07-25 Thread Zooko O'Whielacronx
On Wed, Jul 7, 2010 at 3:32 AM, Jonathan Hartley wrote: > > I presume this problem would go away if future versions of Python > itself were compiled on Windows with something like MinGW gcc. You might want to track issue3871. Roumen Petrov has done a lot of work to make CPython compilable with mi

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Joel Goldstick
Edward Diener wrote: Are there any documents about multiple versionsof Python coexisting in the same OS ( Windows in my case ) and what pitfalls to look out for ? I have already run into a number of them. I installed Python 2.7 and 3.1.2 into completely folders, but immediately ran into serious

Re: Compare two nested dictionaries

2010-07-25 Thread Raymond Hettinger
[targetsmart] > > I am trying to compare two nested dictionaries, I want to know what is > > the exact difference between them. I tried this solution [Steven D'Aprano] > If you want to know the difference between two dictionaries, you have to > consider: > > (1) Keys that are in the first dict, b

Re: Builtn super() function. How to use it with multiple inheritance? And why should I use it at all?

2010-07-25 Thread Raymond Hettinger
On Jul 24, 3:56 am, Lacrima wrote: > Thank you for your answer. You're welcome. > Some things are still not clear. Your example works great. But if I > remove "super(SuperClass1, self).__init__(**kwds)" from SuperClass1's > __init__, the example stops working. That is when I instantiate > SubCla

Re: Constructor call in the same class?

2010-07-25 Thread Karsten Wutzke
> > You have to create your dict somewhere else. You can either set it from > outside: > > class Enum(RootFragment): >     ... > > Enum._jpaTypes = { ... } > THANKS for the quick help. Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare two nested dictionaries

2010-07-25 Thread News123
Hi, On 07/25/2010 06:21 PM, Steven D'Aprano wrote: > On Sun, 25 Jul 2010 08:03:06 -0700, targetsmart wrote: > >> Hi, >> I am trying to compare two nested dictionaries, I want to know what is >> the exact difference between them. I tried this solution >> >> ... >> s1 = set(result1) >>

Re: Compare two nested dictionaries

2010-07-25 Thread Steven D'Aprano
On Sun, 25 Jul 2010 08:03:06 -0700, targetsmart wrote: > Hi, > I am trying to compare two nested dictionaries, I want to know what is > the exact difference between them. I tried this solution > > ... > s1 = set(result1) > s2 = set(result2) > print s1 - s2 > > but it does

Re: Constructor call in the same class?

2010-07-25 Thread Thomas Jollans
On 07/25/2010 05:41 PM, Karsten Wutzke wrote: > What's wrong with: > > class Enum(RootFragment): > __jpaTypes = { > # complete! > 'CascadeType': Enum("javax.persistence.CascadeType"), > 'DiscriminatorType': > Enum("javax.persistence.DiscriminatorType"), > 'EnumT

Constructor call in the same class?

2010-07-25 Thread Karsten Wutzke
What's wrong with: class Enum(RootFragment): __jpaTypes = { # complete! 'CascadeType': Enum("javax.persistence.CascadeType"), 'DiscriminatorType': Enum("javax.persistence.DiscriminatorType"), 'EnumType': Enum("javax.persistence.EnumType"), 'FetchType': E

Compare two nested dictionaries

2010-07-25 Thread targetsmart
Hi, I am trying to compare two nested dictionaries, I want to know what is the exact difference between them. I tried this solution ... s1 = set(result1) s2 = set(result2) print s1 - s2 but it doesn't seem show any difference, but assert result1 == result2 fails could so

Re: Unicode error

2010-07-25 Thread Steven D'Aprano
On Sun, 25 Jul 2010 13:52:33 +0100, Nobody wrote: > On Fri, 23 Jul 2010 18:27:50 -0400, Terry Reedy wrote: > >> But in the >> meanwhile, once you get an error, you know what it is. You can >> intentionally feed code bad data and see what you get. And then maybe >> add a test to make sure your cod

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Gelonida
On 07/25/2010 02:46 PM, Edward Diener wrote: > On 7/25/2010 6:07 AM, Gelonida wrote: >> Hi Edward, >> >> There the windows solution could be something like a small 'pystarter' >> program, which would decide depending on the file's location / the >> file's first line which python should be started.

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread News123
On 07/25/2010 02:46 PM, Edward Diener wrote: > On 7/25/2010 6:07 AM, Gelonida wrote: >> There the windows solution could be something like a small 'pystarter' >> program, which would decide depending on the file's location / the >> file's first line which python should be started. > > This does n

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Thomas Jollans
On 07/25/2010 02:46 PM, Edward Diener wrote: > The problem with this is that you forget that a script can invoke Python > internally. So whether one uses the console or file association method > of invoking Python externally, any already written script can use either > internally. Maybe it's just

Re: Unicode error

2010-07-25 Thread Nobody
On Fri, 23 Jul 2010 18:27:50 -0400, Terry Reedy wrote: > But in the > meanwhile, once you get an error, you know what it is. You can > intentionally feed code bad data and see what you get. And then maybe > add a test to make sure your code traps such errors. That doesn't really help with exce

Re: Socket performance

2010-07-25 Thread Navkirat Singh
On 25-Jul-2010, at 5:52 PM, Roy Smith wrote: > In article <4c4bd0b1$0$1624$742ec...@news.sonic.net>, > John Nagle wrote: > >>1. When writing to a TCP socket, write everything you have to write >>with one "send" or "write" operation if at all possible. >>Don't write a little

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 2:20 AM, Steven D'Aprano wrote: On Sat, 24 Jul 2010 22:03:48 -0700, Chris Rebert wrote: Are the .py and .pyc extensions the only ones which are associated with Python or are there others, for a normal Python installation in Windows ? There's also .pyw Also .pyo .py = Python so

Re: Light-weight/very-simple version control under Windows using Python?

2010-07-25 Thread Anssi Saari
pyt...@bdurham.com writes: > 1. Use an existing version control utility. There are lots of options > here(!), any recommendations on a light weight, open source one that > xcopy installs under Windows with lots of command line options? Personally, I like RCS. It seems fulfil your requirements. Yo

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Edward Diener
On 7/25/2010 6:07 AM, Gelonida wrote: Hi Edward, On 07/25/2010 04:40 AM, Edward Diener wrote: I found the solutions too exotic for actual use, and completely ineffectual for the cases I originally cited. The people in that thread seem to have completely forgotten that Python can be invoked ext

Re: Socket performance

2010-07-25 Thread Roy Smith
In article <4c4bd0b1$0$1624$742ec...@news.sonic.net>, John Nagle wrote: > 1. When writing to a TCP socket, write everything you have to write > with one "send" or "write" operation if at all possible. > Don't write a little at a time. That results in sending small >

Re: Multiple versions of Python coexisting in the same OS

2010-07-25 Thread Gelonida
Hi Edward, On 07/25/2010 04:40 AM, Edward Diener wrote: > I found the solutions too exotic for actual use, and completely > ineffectual for the cases I originally cited. The people in that thread > seem to have completely forgotten that Python can be invoked externally > and internally both throu

Re: Library versions

2010-07-25 Thread Lawrence D'Oliveiro
In message <2cb0c88b-58ea-4704-8578-2ebd766f1...@t10g2000yqg.googlegroups.com>, Peo wrote: > My current plan is to call the library something like 'foo1' and > import it into scripts like 'import foo1 as foo'. Releases that change the > API would be installed as 'foo2', 'foo3' and so on. This wo

Re: Are those features still the same?

2010-07-25 Thread francogrex
Terry Reedy wrote: >As other have said, mostly, but I would change the following... Thanks for all those who replied. I know these are not all the features but some of them and again this is not a comparison but a little taste of what python offers today, and the replies were very informative. B

Re: numpy installation

2010-07-25 Thread David Cournapeau
Hi Jia, On Sun, Jul 25, 2010 at 12:01 PM, Jia Hu wrote: > Hello: > > I tried to install numpy 1.4.1 from source under ubuntu following > instruction at http://docs.scipy.org/doc/numpy/user/install.html > I type "" python setup.py build –help-fcompiler ""  and it says gnu95 is > found. Then I run