[IPython-user] copy paste

Steve Lianoglou lists.steve@arachnedesign....
Thu Sep 13 21:54:27 CDT 2007


H i
,
> 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.

-steve

>
> 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.
> _______________________________________________
> IPython-user mailing list
> IPython-user@scipy.org
> http://lists.ipython.scipy.org/mailman/listinfo/ipython-user



More information about the IPython-user mailing list