how to give focus to another application

2008-06-25 Thread massimo s.
Hi, I would like to know if 1)there is a Python way to tell under which terminal process a Python command-line application is running 2)there is a Python way to tell the OS to give focus to another window. Solutions for Windows, Linux and OS X are welcome, even if OS-specific (of course general

Re: Is anyone happy with csv module?

2007-12-12 Thread massimo s.
Thanks to everyone in this thread. As always on this newsgroup, I learned very much. I'm also quite embarrassed of my ignorance. Only excuse I have is that I learned programming and Python by myself, with no formal (or informal) education in programming. So, I am often clumsy. On Dec 12, 1:29

Re: Is anyone happy with csv module?

2007-12-12 Thread massimo s.
On Dec 12, 2:58 pm, Neil Cerutti [EMAIL PROTECTED] wrote: On 2007-12-11, massimo s. [EMAIL PROTECTED] wrote: Hi, I'm struggling to use the python in-built csv module, and I must say I'm less than satisfied. Apart from being rather poorly documented, I find it especially cumbersome

Is anyone happy with csv module?

2007-12-11 Thread massimo s.
Hi, I'm struggling to use the python in-built csv module, and I must say I'm less than satisfied. Apart from being rather poorly documented, I find it especially cumbersome to use, and also rather limited. What I dislike more is that it seems working by *rows* instead than by *columns*. So I

Re: Is anyone happy with csv module?

2007-12-11 Thread massimo s.
On 11 Dic, 22:37, John Machin [EMAIL PROTECTED] wrote: On Dec 12, 6:14 am, massimo s. [EMAIL PROTECTED] wrote: Hi, I'm struggling to use the python in-built csv module, and I must say I'm less than satisfied. Apart from being rather poorly documented, Patches are welcome :-) Yes

Re: Is anyone happy with csv module?

2007-12-11 Thread massimo s.
On 11 Dic, 20:24, Guilherme Polo [EMAIL PROTECTED] wrote: Post your actual problem so you can get more accurate help. Hi Guilhermo, I have not an actual problem. I'm just trying to use the CSV module and I mostly can get it working. I just think its interface is much less than perfect. I'd

Re: Is anyone happy with csv module?

2007-12-11 Thread massimo s.
On 12 Dic, 00:08, Gabriel Genellina [EMAIL PROTECTED] wrote: Note that all the above (as any operation involving a whole *column*) requires reading the whole file in memory. Working by rows, on the other hand, only requires holding ONE row at a time. For big files this is significant. An

problem with hack using multiple inheritance for plugins

2007-06-28 Thread massimo s.
Before all, I'm not a professional programmer but just a biophysics ph.d. student, so if something makes you scream of horror, please forgive me... Ok, this is not straightforward at all. I am working on an application that uses plugins. Plugins are coded as small classes that become inherited by

Re: problem with hack using multiple inheritance for plugins

2007-06-28 Thread massimo s.
At this point, it seems too much a deep object-oriented hell to be able to dig it myself. Would you help me getting some cue on the problem? Update. Now I know that: - every sane Python class should return type 'instance' after type(self) - when disabling the multiple-inheritance-hack, the

Re: problem with hack using multiple inheritance for plugins

2007-06-28 Thread massimo s.
On 28 Giu, 13:45, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: massimo s. a écrit : At this point, it seems too much a deep object-oriented hell to be able to dig it myself. Would you help me getting some cue on the problem? Update. Now I know that: - every sane Python class

Re: problem with hack using multiple inheritance for plugins

2007-06-28 Thread massimo s.
On 28 Giu, 13:45, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: side-note wrt/ this snippet: for plugin_name in self.config['plugins']: try: plugin=__import__(plugin_name) try: print type(self)

Re: problem with hack using multiple inheritance for plugins

2007-06-28 Thread massimo s.
On 28 Giu, 13:45, Bruno Desthuilliers bruno. [EMAIL PROTECTED] wrote: wxFrame is obviously a new-style class. I don't know if it's true, however. I tried that: class A(object): ... def __init__(self): ... print type(self) ... a=A() class '__main__.A' so in fact what I see

Re: problem with hack using multiple inheritance for plugins

2007-06-28 Thread massimo s.
On 28 Giu, 14:41, massimo s. [EMAIL PROTECTED] wrote: The new-style behaviour only appears when wxFrame is plugged with the current hack. That is: - print type(self) in wxFrame alone returns type 'instance' - print type(self) in the plugged (multiply inherited) wxFrame returns class

Re: problem with hack using multiple inheritance for plugins

2007-06-28 Thread massimo s.
On 28 Giu, 15:37, Peter Otten [EMAIL PROTECTED] wrote: massimo s. wrote: Again: using a new-style plugin class for multiple inheritance does not work. This statement is certainly too broad. [earlier] TypeError: unbound method _plug_init() must be called with dummyguiplugGui instance

Re: problem with hack using multiple inheritance for plugins

2007-06-28 Thread massimo s.
On 28 Giu, 15:37, Peter Otten [EMAIL PROTECTED] wrote: Post a self-contained example. Now I'm even more confused. The self-contained example is below... and it works, using only old-style declarations. #!/usr/bin/env python import wx import cmd global CLI_PLUGINS global GUI_PLUGINS class

Re: problem with hack using multiple inheritance for plugins

2007-06-28 Thread massimo s.
Uh, oh. I think I found the bug, and it was a *really stupid bug*. The list of GUI_PLUGINS was empty... so there was no plugin class that was inherited. I'm embarrassed to have wasted your time that way. However I learned a lot about new-style classes and so on, so for me it was a learning

Re: of destructors, open files and garbage collection

2007-05-26 Thread massimo s.
No, it removes the association between the name 'item' and the object it is currently bound to. In CPython, removing the last such reference will cause the object to be gc'ed. In other implementations, actual deletion may occur later. You probably should close the files directly and arrange

of destructors, open files and garbage collection

2007-05-24 Thread massimo s.
Hi, Python 2.4, Kubuntu 6.06. I'm no professional programmer (I am a ph.d. student in biophysics) but I have a fair knowledge of Python. I have a for loop that looks like the following : for item in long_list: foo(item) def foo(item): item.create_blah() #--this creates item.blah;

Re: of destructors, open files and garbage collection

2007-05-24 Thread massimo s.
It will delete the *name* `item`. It does nothing to the object that was bound to that name. If the name was the only reference to that object, it may be garbage collected sooner or later. Read the documentation for the `__del__()` method for more details and why implementing such a method

Re: of destructors, open files and garbage collection

2007-05-24 Thread massimo s.
Relying on the `__del__()` method isn't a good idea because there are no really hard guaranties by the language if and when it will be called. Ok, I read the __del__() docs and I understand using it is not a good idea. I can easily add a close_files() method that forces all dangling files to

Re: Pep 3105: the end of print?

2007-02-15 Thread massimo s.
Isn't the very concept of major releases (1.x, 2.x, 3.x) that they *can* be not backwards-compatible with previous releases? m. -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple inheritance of a dynamic list of classes?

2007-02-13 Thread massimo s.
On 13 Feb, 12:46, Peter Otten [EMAIL PROTECTED] wrote: Well, what problems ocurring with class A: pass class B: pass class C(A, B): pass could be avoided by writing class A: pass class B(A): pass class C(B): pass instead? Classes have to be designed for subclassing, so essentially you