[IPython-user] copy paste

humufr@yah... humufr@yah...
Thu Sep 13 20:40:31 CDT 2007


Hi,

I have a stupid question which has been ask and answerd before but I have been 
unable to find a message with it. I would like to know if it's possible when 
you are doing a copy-paste (on linux middle button) to tell to ipython to not 
take in count the blank line.

Exemple if I copy paste the code:

class Point():
    def __init__(self,x=0,y=0):
        self.x = x
        self.y = y
            
    def __str__(self):
        return '(' + str(self.x) + ', ' + str(self.y) + ')'
 
    def __add__(self, other):
        return Point(self.x + other.x, self.y + other.y)
 

I obtain this:

In [1]: class Point():
   ...:         def __init__(self,x=0,y=0):
   ...:             self.x = x
   ...:         self.y = y
   ...:
   ...:     def __str__(self):
   ...:             return '(' + str(self.x) + ', ' + str(self.y) + ')'
   ...:

In [2]:     def __add__(self, other):
   ...:             return Point(self.x + other.x, self.y + other.y)
   ...:


so naturally I can't test the class like this. If you have a solution for my 
problem I'll be very happy :)

Thank you for ipython it's a great software.

N.


More information about the IPython-user mailing list