Classes and the command line

Jean-Michel Pichavant jeanmichel at sequans.com
Mon Oct 27 11:26:01 CET 2014


----- Original Message -----
> From: "Seymore4Head" <Seymore4Head at Hotmail.invalid>
> To: python-list at python.org
> Sent: Monday, 27 October, 2014 3:27:18 AM
> Subject: Classes and the command line
> 
> I am trying to learn classes.
> I am currently using Python 2.7 at the command line.
> If you try to type commands at the command line and make the
> slightest
> mistake you have to start over.
> I was trying to copy and paste these instructions into the command
> prompt.
> 
> http://en.wikibooks.org/wiki/Python_Programming/Classes
> >>> class Foo:
> ...     def setx(self, x):
> ...         self.x = x
> ...     def bar(self):
> ...         print self.x
> 
> There is really no way to do that without pasting line by line is
> there and adding deleting spaces?  And if you use spaces and tabs,
> they are not the same.

You could use Ipython http://ipython.org/, if you're familiar with the python shell you won't get lost as it's quite the same with a lot of features added.
One of them is the %paste magic function, it will paste your clipboard taking care of the indentation for you.

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


More information about the Python-list mailing list