[IPython-user] copy paste
Thu Sep 13 21:54:27 CDT 2007
> 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.
Use the `cpaste` "magic" function ... it'll take care of this for you.
You can type "cpaste?" at the ipython prompt for more details.
> 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 : 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 : 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.
> IPython-user mailing list
More information about the IPython-user