Python change a value of a variable by itself.

2009-02-17 Thread Kurda Yon
Hi, I have the following simple code: r = {} r[1] = [0.00] r_new = {} print r[1][0] r_new[1] = r[1] r_new[1][0] = r[1][0] + 0.02 print r[1][0] It outputs: 0.0 0.02 it is something strange to me since in the first and second case I output the same variable (r[1][0]) and it the two cases it

Re: How to build the pysqlite? Where to find the sqlite3.h?

2008-11-06 Thread Kurda Yon
But I read your statement and understood that I do not need to install neither pysqlite no sqlite. In my Python session I tried to type from sqlite import connect and it does not compaline. It meand that Python see the database!!! I hope. I don't think so. There is no sqlite module in

How to re-import a function from a module?

2008-11-05 Thread Kurda Yon
Hi, I have the following small problem. I run Python interactively. In the beginning of the run I import many functions from many modules. Than I execute some commands and notice that one of the imported functions contains a mistake. I open another terminal in which I open the file with the

Re: How to build the pysqlite? Where to find the sqlite3.h?

2008-11-05 Thread Kurda Yon
On Nov 5, 1:55 pm, Thorsten Kampe [EMAIL PROTECTED] wrote: You (and Kurda) keep on talking the wrong stuff. First: you don't need pysqlite2. SQLite support is included in the latest Python as module sqlite3. By the way, I think the above statement is very helpfull. I tried to install the

How to build the pysqlite? Where to find the sqlite3.h?

2008-11-04 Thread Kurda Yon
Hi, I try to build and install pysqlite? After I type python setup.py build I get a lot of error messages? The first error is src/ connection.h:33:21: error: sqlite3.h: No such file or directory. So, I assume that the absence of the sqlite3.h is the origin of the problem. I found on the web,

Re: How to build the pysqlite? Where to find the sqlite3.h?

2008-11-04 Thread Kurda Yon
On Nov 4, 8:59 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Nov 5, 6:47 am, Kurda Yon [EMAIL PROTECTED] wrote: Hi, I try to build and install pysqlite? After I type python setup.py build I get a lot of error messages? The first error is src/ connection.h:33:21: error: sqlite3.h

How to import from a file which is not in the current directory?

2008-10-22 Thread Kurda Yon
Hi, I would like to import a function from a file which is located not in the same directory as the main program (from which the function needed to be imported). Could anybody pleas tell me how to do that? Thank you in advance. -- http://mail.python.org/mailman/listinfo/python-list

How to give a global variable to a function which is in a module?

2008-10-01 Thread Kurda Yon
Hi, I would like to declare a global variable, which is seen to a particular function. If I do as the following it works: x = 1 def test(): global x print x return 1 However, it does not helps since my function is in a separate file. In other words I have a main program which has the

Are there any free source for matrix diagonalization?

2008-10-01 Thread Kurda Yon
Hi, Does Python have a free source community for the numerical problems coding? I mean, are there some web-sites where I could find a free code for such problems like calculation of eigenvectors and eigenvalues of matrices? Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Web programming in Python.

2008-09-28 Thread Kurda Yon
Hi, I am totaly newbie in the Python's web programming. So, I dont even know the basic conceptions (but I have ideas about php-web- programming). Does it work in a similar way? First, I have to install a Python-server? On the server where I have my web site (it runs under Linux) if I type python

Re: Web programming in Python.

2008-09-28 Thread Kurda Yon
1. On my server (in my directory) I found cgi-bin subdirectory. 2. In the cgi-bin I have created a file test.py. 3. In that file I put: #!/usr/bin/python2.4 python print Hello, World! (I have checked, I have /usr/bin/python2.4 directory.) 4. I give the following permissions to the test.py:

How to make a function associated with a class?

2008-07-01 Thread Kurda Yon
Hi, I have a class called vector. And I would like to define a function dot which would return a dot product of any two vectors. I want to call this function as follow: dot(x,y). Well, I can define a functions dot outside the class and it works exactly as I want. However, the problem is that

Re: How to make a function associated with a class?

2008-07-01 Thread Kurda Yon
On Jul 1, 5:01 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On 1 juil, 22:43, Kurda Yon [EMAIL PROTECTED] wrote: Hi, I have a class called vector. And I would like to define a function dot which would return a dot product of any two vectors. I want to call this function as follow

Functions associated with a class.

2008-06-30 Thread Kurda Yon
Hi, I start to learn the object oriented programing in Python. As far as I understood, every class has a set of corresponding methods and variables. For me it is easy to understand a method as a one-argument function associated with a class. For example, if I call x.calc and y.calc and if x and y

method involving two objects is that possible in Python?

2008-06-27 Thread Kurda Yon
Hi, I just started to learn Python. I understood how one can create a class and define a method related with that class. According to my understanding every call of a methods is related with a specific object. For example, we have a method length, than we call this method as the following

Do I need self and other?

2008-06-27 Thread Kurda Yon
Hi, I found one example which defines the addition of two vectors as a method of a class. It looks like that: class Vector: def __add__(self, other): data = [] for j in range(len(self.data)): data.append(self.data[j] + other.data[j]) return Vector(data) In this example one

C++ or Python

2008-06-27 Thread Kurda Yon
I would like to know what are advantages of Python in comparison with C ++? In which cases and why Python can be a better tool than C++? Thank you! -- http://mail.python.org/mailman/listinfo/python-list

Re: Do I need self and other?

2008-06-27 Thread Kurda Yon
On Jun 27, 6:32 pm, Hans Nowak [EMAIL PROTECTED] wrote: Kurda Yon wrote: Hi, I found one example which defines the addition of two vectors as a method of a class. It looks like that: class Vector: def __add__(self, other): data = [] for j in range(len(self.data