Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79777

Re: Classes and the command line

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.roellig-ltd.de!open-news-network.org!cyclone03.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!post02.fr7!fx01.am4.POSTED!not-for-mail
From alister <alister.nospam.ware@ntlworld.com>
Subject Re: Classes and the command line
Newsgroups comp.lang.python
References <8uar4a1pa6d631ktr33h8rau1ilf2rjvi3@4ax.com> <mailman.15220.1414379184.18130.python-list@python.org> <qver4ah6884ro8bun7k9drvoegh3v9rcec@4ax.com>
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Lines 91
Message-ID <1Rp3w.1$7w2.0@fx01.am4> (permalink)
NNTP-Posting-Host 82.9.78.47
X-Complaints-To http://netreport.virginmedia.com
X-Trace 1414408637 82.9.78.47 (Mon, 27 Oct 2014 11:17:17 UTC)
NNTP-Posting-Date Mon, 27 Oct 2014 11:17:17 UTC
Organization virginmedia.com
Date Mon, 27 Oct 2014 11:17:17 GMT
X-Received-Body-CRC 3443401272
X-Received-Bytes 4400
Xref csiph.com comp.lang.python:79777

Show key headers only | View raw


On Sun, 26 Oct 2014 23:32:08 -0400, Seymore4Head wrote:

> On Mon, 27 Oct 2014 14:06:11 +1100, Ben Finney
> <ben+python@benfinney.id.au> wrote:
> 
>>Seymore4Head <Seymore4Head@Hotmail.invalid> writes:
>>
>>> I am trying to learn classes.
>>> I am currently using Python 2.7 at the command line.
>>
>>(I think you mean “the interactive Python interpreter”, or just “the
>>Python shell”.)
>>
>>Since you are learning Python, I will strongly recommend you ignore
>>Python 2 unless it becomes unavoidable.
>>
> At the moment, it is unavoidable.  The instructors are teaching Python 2
> so I have to learn Python 2, for now.
> 
>>Instead, learn Python 3 primarily; it is much better because it omits a
>>bunch of legacy behaviour you don't need.
>>
>>> If you try to type commands at the [interactive shell] and make the
>>> slightest mistake you have to start over.
>>
>>Right. There is line-by-line history, and editing enabled with the
>>“readline” plug-in. (This is an advantage of using a programmer-
friendly
>>operating system, which MS Windows sadly is not.)
>>
>>> I was trying to copy and paste these instructions into the
>>> [interactive Python shell].
>>>
>>> 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.
>>
>>Right on all counts.
>>
>>The interactive Python shell is good for very quickly experimenting and
>>demonstrating how Python actually behaves, statement by statement. But
>>as you point out, it is not a good choice for anything more complex. It
>>is a good learning and debugging tool.
>>
>>When you start to write larger units of code, like a class or a
>>function, you can trade immediacy for flexibility: write your code into
>>a text editor, save it to a file ‘foo.py’, then run that code at a
>>separate OS command prompt by invoking ‘python foo.py’ in the 
terminal.
>>
>>That way, you can continue to adjust and tweak the code as you learn how
>>your changes affect the code. You do need to keep invoking the actions
>>separately – edit the file, save the file, run the file with Python –
>>but this is what's needed when you want to run a program more than once
>>anyway, so it's a good step to take.
>>
>>Find a good, *general-purpose* programmer's editor. Preferably licensed
>>under free software terms, with a strong community supporting it, and
>>available on all major platforms for when you switch to a decent
>>programmer-friendly operating system.
> 
> I am actually using Notepad some too.
> 
> Thanks

notepad is not a programmer friendly editor

personally I like Geany as it is nice and basic but still offers a lot of 
programmer friendly features such as syntax highlighting, a small 
terminal window which I use to run the interactive terminal for testing 
quick one-liners & pressing f5 will save & run the current file being 
edited.

www.geany.org

Notepad+ is also often suggested along with many other programmer editors/
Integrated development environments (IDE).

I would advise you keep away from the more complex IDE's for now as you 
do not want to overload your learning requirements.


-- 
Who the mad would destroy, first they make Gods.
		-- Bernard Levin

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Classes and the command line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-26 22:27 -0400
  Re: Classes and the command line Rustom Mody <rustompmody@gmail.com> - 2014-10-26 20:05 -0700
    Re: Classes and the command line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-26 23:28 -0400
      Re: Classes and the command line Terry Reedy <tjreedy@udel.edu> - 2014-10-28 00:14 -0400
  Re: Classes and the command line Ben Finney <ben+python@benfinney.id.au> - 2014-10-27 14:06 +1100
    Re: Classes and the command line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-26 23:32 -0400
      Re: Classes and the command line alister <alister.nospam.ware@ntlworld.com> - 2014-10-27 11:17 +0000
        Re: Classes and the command line Chris Angelico <rosuav@gmail.com> - 2014-10-27 22:33 +1100
      Re: Classes and the command line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-27 09:34 -0400
  Re: Classes and the command line Chris Angelico <rosuav@gmail.com> - 2014-10-27 14:10 +1100
    Re: Classes and the command line Rustom Mody <rustompmody@gmail.com> - 2014-10-26 20:18 -0700
      Re: Classes and the command line Chris Angelico <rosuav@gmail.com> - 2014-10-27 14:24 +1100
      Re: Classes and the command line Rustom Mody <rustompmody@gmail.com> - 2014-10-26 20:30 -0700
      Re: Classes and the command line Terry Reedy <tjreedy@udel.edu> - 2014-10-28 00:08 -0400
      Re: Classes and the command line Chris Angelico <rosuav@gmail.com> - 2014-10-28 15:57 +1100
    Re: Classes and the command line Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-26 23:33 -0400

csiph-web