Re: [Tutor] Clearing Python text

2012-12-15 Thread Kwpolska
On Sat, Dec 15, 2012 at 2:10 AM, Mike G  wrote:
> I use Windows XP, Python 2.7, Notepad++ as my editor, and generally
> run my .py files from cmd, this is how I toggle between running my .py
> file after an edit (and save) and subsequently clearing the screen -
> it's pretty easy.
>
> I "arrow-up/arrow-down" on the keyboard to reprint (type) the latest
> command in cmd, this toggles between running my .py file...
> runs my file ... C:\Python27\MyScripts>python helloworld.py
>
> and to clear whatever printed to the screen...
> clears the screen ... C:\Python27\MyScripts>cls
>
> Once you've typed both at the prompt just arrow up or down, then hit
> enter - file run or screen cleared, as well saves time retyping.
>
> Sorry if I missed it but this works for me because I too prefer to
> print to a cleared screen, don't know why, just do.
>
> Mike :)
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

Or cls & python file.py.

(clear; ./file.py for the 2 POSIX folks that want this behavior.)
-- 
Kwpolska 
stop html mail  | always bottom-post
www.asciiribbon.org | www.netmeister.org/news/learn2quote.html
GPG KEY: 5EAAEA16
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended texts for self-study to master software engineering?

2012-12-15 Thread Alan Gauld

On 15/12/12 05:26, boB Stepp wrote:


In my case what I would eventually like to be able to do is develop
complex, graphically intensive educational software.


OK, the first thing to point out is that software engineering is not the 
same as programming. In the same way that civil engineering is not the 
same as bricklaying.


SE is about the skills and practices needed to run repeatable software 
projects. The focus is on techniques that apply regardless of the 
problem domain. The focus is also mainly on large scale projects 
involving teams of developers rather than a single individual
or even a few. This has typically led to practices that are overly 
onerous for small projects.


The recent trend to Agile has partially addressed the needs of small 
projects by introducing a parallel world of software practice that is 
more suited to small projects (usually cited as up to about 30 
developers). So if thats how you see your projects turning out then you 
should focus on material geared to Agile rather than traditional SE.


Many of the techniques are similar of course - the use of version 
control, automated testing, good design patterns etc. But traditional SE 
has a lot more in the way of heavyweight project management too, quality 
gates, peer reviews, project control files etc and encourages use of 
heavyweight tools (CASE, IPSE, Projet planning, Requirement mgt etc etc) 
Agile is more about getting a team talking and collaborating

directly with rapid development cycles and feedback.

On the assumption you fit the agile model I'd start with the Agile 
Manifesto:  http://agilemanifesto.org


and then read the wikipedia article:

http://en.wikipedia.org/wiki/Agile_software_development

The software engineering link box at the bottom offers a cornucopia of 
topics to research after that.



textbooks would be for self-study. So my question is what would be a
sequence of books to acquire the knowledge I would need that are
especially well-suited to self-study?


Now to turn to this aspect, I'd recommend a few books for general good 
practice:


Structure and Interpretation of Computer Programs
(SICP - available online)

Code Complete

Object Oriented Analysis and Design

Programming Pearls (vols 1 & 2)

Then there are more topic specific texts but I can't personally 
recommend anything in your topic space so I'll let others comment

on that.

HTH

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended texts for self-study to master software engineering?

2012-12-15 Thread Wayne Werner

On Fri, 14 Dec 2012, boB Stepp wrote:


This is obviously not a directly python-related question; however, I
do believe that it would be of interest to many aspiring programmers
who are diligently learning python on their own.

So, through self-study, I would like to be able to acquire the
knowledge I would need to become a competent designer and programmer,
using good software engineering practices. Now I could go online and
look at typical courses taken by those pursuing software engineering
or computer science degrees and even come up with the textbooks that
such courses use. But I would have no idea of how well-suited such
textbooks would be for self-study. So my question is what would be a
sequence of books to acquire the knowledge I would need that are
especially well-suited to self-study? I may be asking for the
unanswerable, but I am hoping to be pointed to some good texts for my
future studies.


Rather than simple self-study, why not take advantage of the offerings by 
such folks as Coursera, Edx, or Kahn Academy?


They all have free courses in programming and software development that 
require a large degree of self-motivation (after all, you didn't pay 
anything for it so you don't have the same drive as regular college), but 
it has the added benefit of hundreds, perhaps thousands of other active 
participants who are also learning at the same time.


*Most* of the Python books that I've read are at least as well-suited to 
self study as any of the rest of them. Although, my own personal 
experience is that contributing to this list has done more to help me 
really understand the basics of Python and development than anything else.


HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Learning Python through automating web application testing.

2012-12-15 Thread wrw
On Dec 7, 2012, at 5:46 PM, marcusw4...@hotmail.co.uk  
wrote:

> Hello all,
> 
> I'm new to posting on mailing lists so hopefully I've picked the correct one 
> for my question(s).
> 
> A little about my programming experience first.
> 

[byte]

> Because of this fear I've never admitted I've got a ready made project just 
> waiting for me to tackle...
> 
> Until now!
> 
> I would like to learn to automate the testing of a http(s) web 
> site/applications but feel slightly overwhelmed by this task so would like to 
> ask for some initial guidance. 
> 

Wow (!) welcome the wonderful world of Python.  I have several comments - but 
let me start (with apologies) by encouraging you to think about another initial 
project.  Others may well disagree with me (and I'd welcome that), but from my 
point of view, your choice (although by starting small can probably be done 
with relatively little of YOUR python code to call libraries), does require a 
deeper understanding of several parallel (pun intended) aspects of programming 
for web, ssh, sockets, python, your OS, and your chosen python libraries than 
you may realize.

Just to mention one - simulation of pounding on the test site by several users 
will require multi-processing from a pool of parallel jobs.  The standard 
Python library has the tools to handle this, but it isn't an easy subject for 
someone new to programming to get your mental arms wrapped around.  I'm not 
familiar with the Chun book, so my worries may be completely misplaced (and if 
so, I apologize), but if you aren't really comfortable yet with OOP, and class 
definitions that start with '__init__(self…)' - this project isn't a good place 
to start.

You can get some feel for your level of achievement by looking at urllib, 
urllib2, and httplib in the python standard documentation  (and maybe looking 
at beautifulsoup (either BS3 or BS4).  Then, if you want to go ahead - the kind 
of questions you will be coming up with are probably better addressed on the 
more general python-l...@python.org discussion group.  (There are lots of folks 
here to read both, so you won't need to cross post.) 

> These are some of questions that I have.
> 
> How do I go about this? 
> 
> Where do I start?  
> 
> There's just so much out there to help with learning Python I'm experiencing 
> information overload!  
> 
> How do I stop myself from trying to run before I can walk?
> 

My suggestion would be to pick a project that yields something useful around 
your house or apartment (flat?) or a single-function utility that would be 
useful to you (maybe some sort of backup utility that is customized for the way 
you work).

> In a perfect world a step by step guide, in automating web tests, using 
> Python is what I'm after but failing that(!) which sites/forums/mailing lists 
> are of particular interest to someone who would like to learn Python 
> programming initially through automating web tests?  (By web tests, to begin 
> with, I mean automated regression testing of a site by multiple users)
> 

When you get to the point of actually starting to tackle this - there is one 
more question you need to answer before you start.  Are you trying to check for 
correct functionality at all branch points when users respond appropriately, or 
are you wanting to check for possible ways the site can be crashed by users 
typing garbage or attempting to attack the site?  The latter is a MUCH more 
complex project.

Sorry to sound so discouraging (and as I said, others may have much more 
encouraging suggestions for ways to approach this),
-Bill

> At work we use Selenium and Java so I'm aware that Selenium comes with a 
> Python driver.  Would that be a good place to start?
> 
> Apologies if I'm not supposed to ask more than one question per mail but 
> these are all closely related and could be thought of as "newbie struggling 
> to see the wood/forest for the trees!"
> 
> Many thanks for your help
> 
> Regards
> Marcus
> 
> 
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended texts for self-study to master software engineering?

2012-12-15 Thread boB Stepp
On Sat, Dec 15, 2012 at 3:27 AM, Alan Gauld  wrote:

> OK, the first thing to point out is that software engineering is not the
> same as programming. In the same way that civil engineering is not the same
> as bricklaying.
>
> SE is about the skills and practices needed to run repeatable software
> projects. The focus is on techniques that apply regardless of the problem
> domain. The focus is also mainly on large scale projects involving teams of
> developers rather than a single individual
> or even a few. This has typically led to practices that are overly onerous
> for small projects.
>
> The recent trend to Agile has partially addressed the needs of small
> projects by introducing a parallel world of software practice that is more
> suited to small projects (usually cited as up to about 30 developers). So if
> thats how you see your projects turning out then you should focus on
> material geared to Agile rather than traditional SE.
>
> Many of the techniques are similar of course - the use of version control,
> automated testing, good design patterns etc. But traditional SE has a lot
> more in the way of heavyweight project management too, quality gates, peer
> reviews, project control files etc and encourages use of heavyweight tools
> (CASE, IPSE, Projet planning, Requirement mgt etc etc) Agile is more about
> getting a team talking and collaborating
> directly with rapid development cycles and feedback.
>
I understood the points you make above, but was not aware of the
"Agile trend". I have seen books on this topic, but never thought to
take a glance at one. I will definitely have to look into this.

Even though I do not think I am ever likely to be involved in a
project involving teams of developers, I would still want to possess
the knowledge to be able to do so if I had to. I guess I was not as
clear to my intentions as I thought I was. Essentially I would like to
acquire all of the expected knowledge that a person who graduates with
a software engineering and/or computer science degree would be
expected to have. I gave the example of the project I could envisage
doing to exclude areas such as designing operating systems and such
that I believe C.Sc. people typically take courses in if that is one
of their emphasis tracks. Of course I would want to have whatever
basic understandings in such realms that any C.Sc. graduate would be
expected to have.

With all this in mind, I was looking for books that are especially
suitable for self-study to eventually acquire all of this knowledge.
For instance, if someone were to ask me what textbooks to study to
capture the knowledge that it would take to get a B.Sc. or M.Sc. in
physics, I would definitely cull many of the books I had to wade
through during my actual college studies! This is where I am hoping
this list will save me from wasting time and money on difficult to use
books that are not well-written expositions of their subject matter.
As you all know, just like there are many college professors who know
their subject matter very, very well, relatively few seem to be
effective at teaching their students effectively. Textbooks often seem
to follow the same trend.


>
>> textbooks would be for self-study. So my question is what would be a
>> sequence of books to acquire the knowledge I would need that are
>> especially well-suited to self-study?
>
>
> Now to turn to this aspect, I'd recommend a few books for general good
> practice:
>
> Structure and Interpretation of Computer Programs
> (SICP - available online)
>
> Code Complete

I own this book in its second edition. I had read the first edition a
few years ago when I had briefly gotten the "want to program again
bug". McConnell made me aware that what programming I had done in
college was definitely lacking in many recommended software
engineering practices.

> Object Oriented Analysis and Design
>
> Programming Pearls (vols 1 & 2)
>
Thanks, Alan! It does help.
boB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recommended texts for self-study to master software engineering?

2012-12-15 Thread boB Stepp
On Sat, Dec 15, 2012 at 6:48 AM, Wayne Werner  wrote:

>
> Rather than simple self-study, why not take advantage of the offerings by
> such folks as Coursera, Edx, or Kahn Academy?
>

I had briefly looked at Kahn Academy quite a while back, but it did
not seem (at that time) to have what I needed. I will re-investigate.
I had recently looked at the MIT and Stanford free offerings. I liked
the Stanford first course on Intro to C.Sc. and actually started to
work through it, until I went into analysis paralysis! Somehow at
work, which I am not hired to any programming whatsoever, I have
become ever more deeply involved in doing scripts to extend the
capabilities and usefulness of the software environment we do our work
in, which is wonderful providing the users its own scripting
language/environment which is further extendable with external scripts
(to the software) using Perl. I say Perl, as this was the only
language (beyond Solaris shell scripting) available on the system for
doing these things... I am getting off topic! (I did not want to use
C, C++ or Java to manipulate text files.) Anyway, I knew that when we
eventually upgraded our software and hardware that Python would then
become available and I thought that this would give me a better
grounding, starting off, in good programming practices than continuing
in Perl. So now I am trying learn Python as time becomes available.

Anyway, I will look into the suggestions above and see if I can pursue
a close to complete track in C.Sc./software engineering.

> *Most* of the Python books that I've read are at least as well-suited to
> self study as any of the rest of them. Although, my own personal experience
> is that contributing to this list has done more to help me really understand
> the basics of Python and development than anything else.
>
I wholeheartedly agree with you here! I now have a collection of
Python books that I think will get me to where I want to be with
Python. Now I just have to find the time to work through them! And
this list teaches me every day even when I do not have any time at all
for study. Just reading the posts, which are never onerous in their
number each day, constantly teaches. The people on this list go above
and beyond in the level of effort they put into their answers to
questions.

Thanks!
boB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Image Processing

2012-12-15 Thread Ashkan Rahmani
I have developed some simple c++/qt/opencv application with face
detection functionality.
for some reasons I'm going to start again them and I wan to use python 3.
Unfortunately I found opencv not supported in python 3.
1- as I'm new in python programming, is python 3 good choice for me?
2- Opencv binding will be available for python 3?
3- Is there any other image processing library for python 3?
4- Basically python 3 or 2.7 is suitable for image processing?

-- 
Best Regards,
Ashkan R < ashkan...@gmail.com >
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Image Processing

2012-12-15 Thread Alan Gauld

On 15/12/12 19:50, Ashkan Rahmani wrote:


3- Is there any other image processing library for python 3?
4- Basically python 3 or 2.7 is suitable for image processing?


PIL is the defacto standard for image processing on Python.
It is officially only available on Python 2.7 (although I think
I saw a web page on how to make it work with V3).

But in general, if you want industrial strength third party
libraries, it's better to stick with v2.7 for now.


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Trailing spaces affect output in a way I don't understand.

2012-12-15 Thread Steven D'Aprano

On 16/12/12 15:16, boB Stepp wrote:

In the following code:

print(
 """


  _____  _____
 / _|  /|  /   |/   |  |  |
 | |  /  /| | / /|   /| |  |  |__
 | |   _ /  ___ |/ / |__/ | |  |   __|
 | |__| |   /  /  | |   / /   | |  |  |___
 \__/  /__/   |_|  /_/|_|  |__|


  ____  _____
 /   _  \  |  |/ /  |   ___|  |   _  \
 |  | | |  |  |   / /   |  |__|  |_| |
 |  | | |  |  |  / /|   __|   |   _  /
 |  |_| |  |  | / / |  |___   |  | \ \
 \__/  |_/  |__|  |__|  \_\



 """

)

All trailing spaces have been trimmed off the end of the lines. It
results in the following undesired output:

[...]


What greatly puzzles me is that "GAME" prints correctly, but "OVER"
does not. Why?


Wow! This is a tricky question, but so obvious in hindsight.

The problem is that you have three lines, all in "OVER", that end with
a backslash. In Python string literals, backslash-newline is interpreted
as a line continuation, so that the next physical line is joined to the
current line.

Two solutions are:

* Add a space to the end of the backslashes. The space is invisible, and
some editors may strip it out, so this is a fragile solution.

* Change the string to a raw string, r"""...""" so that backslash
interpolation is turned off.




--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Trailing spaces affect output in a way I don't understand.

2012-12-15 Thread boB Stepp
On Sat, Dec 15, 2012 at 10:43 PM, Steven D'Aprano  wrote:

>> What greatly puzzles me is that "GAME" prints correctly, but "OVER"
>> does not. Why?
>
>
> Wow! This is a tricky question, but so obvious in hindsight.
>
> The problem is that you have three lines, all in "OVER", that end with
> a backslash. In Python string literals, backslash-newline is interpreted
> as a line continuation, so that the next physical line is joined to the
> current line.

Ah, ha!! It is obvious now that you pointed it out! Many thanks! This
was driving me bonkers tonight.

> Two solutions are:
>
> * Add a space to the end of the backslashes. The space is invisible, and
> some editors may strip it out, so this is a fragile solution.

In my efforts to understand what was going on, I discovered that
PyScripter's (My current editor that I am playing around with.)
default setting is to trim all line-ending spaces, running into
exactly what you say.

> * Change the string to a raw string, r"""...""" so that backslash
> interpolation is turned off.

And I suppose I could also escape the backslash (\\), too. But your
suggestion sounds the best.

It is funny in retrospect: If I had wanted to create a newline
character I would do the correct thing, but seeing the backslashes as
part of a picture, even after I went into PyScripter's options and
turned on ALL special characters, I was still blind to the fact that a
\n was staring me in the face.

You are one sharp dude! As seem to be just about all of you...

Many thanks!
boB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Trailing spaces affect output in a way I don't understand.

2012-12-15 Thread boB Stepp
On Sat, Dec 15, 2012 at 10:55 PM, boB Stepp  wrote:

> It is funny in retrospect: If I had wanted to create a newline
> character I would do the correct thing, but seeing the backslashes as
> part of a picture, even after I went into PyScripter's options and
> turned on ALL special characters, I was still blind to the fact that a
> \n was staring me in the face.

The above should have been: ...\newline... not \n. I almost missed
your point, Steve!

boB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor