Re: Variable by label

2008-05-16 Thread rocco . rossi
On May 16, 4:27 pm, "inhahe" <[EMAIL PROTECTED]> wrote: > >>> a = 1 > >>> b = eval("a") > >>> b > 1 > >>> a =1 > >>> b = globals()["a"] > >>> b > 1 > >>> a =1 > >>> b = locals()["a"] > >>> b > > 1<[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Is there any function which will

Variable by label

2008-05-16 Thread rocco . rossi
Is there any function which will return a variable by passing to it the string containing the variable's name? Something like this for instance: foo = some_function("foo") or perhaps it's a dictionary. I don't know, but I would really like to find out how it can be done. I guess it is achievable.

Re: Python generators (coroutines)

2008-04-23 Thread rocco . rossi
> Anyway, if you have a blocking operation, the only solution is to use > a thread or a separate process. > > Michele Simionato That's what I thought. It was in fact rather obvious, but I wanted to be sure that I hadn't overlooked some arcane possibility (ex. with the use of exceptions or somet

Python generators (coroutines)

2008-04-23 Thread rocco . rossi
I would really like to know more about python 2.5's new generator characteristics that make them more powerful and analogous to coroutines. Is it possible for instance to employ them in situations where I would normally use a thread with a blocking I/O (or socket) operation? If it is, could someone

Orphaned child processes

2008-04-07 Thread rocco . rossi
I'm using the Python processing module. I've just run into a problem though. Actually, it's a more general problem that isn't specific to this module, but to the handling of Unix (Linux processes) in general. Suppose for instance that for some reason or another, after forking several child processe

xmlrpclib, testing server presence

2008-02-02 Thread rocco . rossi
I'm employing xmlrpclib for a project at work, and I must say that I'm quite impressed with its effectiveness and ease of use. However, I was recently doing some tests when I realized that if the server was down, the client quite simply hanged (no use of "try ... except" here) with no error or tra

Re: Noob question

2008-01-07 Thread rocco . rossi
On Jan 7, 12:09 am, GHZ <[EMAIL PROTECTED]> wrote: > Had the same issue. What you want is: reload() Thanks :) -- http://mail.python.org/mailman/listinfo/python-list

Noob question

2008-01-06 Thread rocco . rossi
Tinkering with Python I find myself often writing scripts and then experimenting with the interactive interpreter, which is really a cool way to learn a language. However, when, after loading a module with import or from module import * and using it, I make a change to the module file, the cha

PyGTK, libglade, and signal_autoconnect

2008-01-04 Thread rocco . rossi
I was having a real hard time trying to accomplish something. I couldn't find a way to automatically connect the "close" button (clicked signal) of a GUI app I was working on, to the gtk.main_quit() function. I had entered this handler directly with the GLADE-3 designer (I DON'T WANT TO USE A DICTI

IDLE question

2007-12-16 Thread rocco . rossi
I'm using IDLE for my Python programming. I can't seem to solve one issue though. Whenever I try to indent a region of code, I simply select it and hit the tab key, as I usually do in most editors, like GEdit or Geany on Linux, for instance, and it works fine. But, if I try to unindent a region of

Loops and things

2007-12-14 Thread rocco . rossi
I was wondering how and if it's possible to write a loop in python which updates two or more variables at a time. For instance, something like this in C: for (i = 0, j = 10; i < 10 && j < 20; i++, j++) { printf("i = %d, j = %d\n", i, j); } So that I would get: i = 0, j = 0 i = 1, j = 1 i = 2

Loops and things

2007-12-14 Thread rocco . rossi
I was wondering how and if it's possible to write a loop in python which updates two or more variables at a time. For instance, something like this in C: for (i = 0, j = 10; i < 10 && j < 20; i++, j++) { printf("i = %d, j = %d\n", i, j); } So that I would get: i = 0, j = 0 i = 1, j = 1 i = 2