Re: [Tutor] Elegant argument index sort

2007-11-08 Thread bob gailer
Dinesh B Vadhia wrote:
 I'm sorting a 1-d (NumPy) matrix array (a) and wanting the index 
 results (b). 
I can't tell from your comments and code what you want. Please provide a 
better explanation and give an example of input and output numbers. Also 
I am not familiar with argsort.
 This is what I have:
  
 b = a.argsort(0)
 b = b+1
  
 The one (1) is added to b so that there isn't a zero index element.  
 Is there a more elegant way to do this?

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread Eddie Armstrong
wesley chun wrote:
 michael's and david's book spends a bit more time
 introducing the concepts of OOP/OOD more carefully and more though
If it had been half the price I'd have bought it for a strong exposition 
of OO principles in Python. However at less than 700pp and c. £54 in the 
UK it won't be added to my bookshelf.
 most aspects of the selling of
 a book (including its cover price) is almost -always out of the
 control of the author(s).
   
I wasn't necessarily accusing the authors of anything, how could I? I 
expect marketing thought they'd get more money this way.   As a previous 
poster said it's probably priced for  academic use.
I also realise the cost of producing books etc
If I were allocating books for students I would still spare them the 
exorbitant cost of this and recommend one or both of the other books. 
They could even get 'Core' + 'Programming'(Lutz), over 2000 quality 
pages for less then the price of this.

And I'm quite sure any educational establishment worthy of the name 
would bridge any gaps.

No disrespect to the authors or for what may be an excellent book but 
not for me. And I think it's a shame - if it specialised in the OOP 
aspects - at half the price it would have been a worthy addition to the 
beginners' library.
Just my opinion

Eddie


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Elegant argument index sort

2007-11-08 Thread Kent Johnson
Dinesh B Vadhia wrote:
 I'm sorting a 1-d (NumPy) matrix array (a) and wanting the index results 
 (b).  This is what I have:
  
 b = a.argsort(0)
 b = b+1
  
 The one (1) is added to b so that there isn't a zero index element.  Is 
 there a more elegant way to do this?

b = a.argsort(0) + 1

?

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread Danyelle Gragsone
It look great.. but being a student I can't afford such a high priced
item.  I guess I will have to wait for the used copies to show up on
amazon :).

Danyelle
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread Kent Johnson
Danyelle Gragsone wrote:
 It look great.. but being a student I can't afford such a high priced
 item.  I guess I will have to wait for the used copies to show up on
 amazon :).

FWIW this book is available to anyone with a .edu email address for 
$71.53 plus shipping, from
http://www.a1books.com/cgi-bin/mktSearch?act=showDescitemcode=0136150314

A little more ($75.29) without a .edu email but still the best price 
found by BestBookDeal:
http://www.bestbookdeal.com/book/compare/0136150314/

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread Danyelle Gragsone
I wonder what schools offer python as a course.  Sadly all the
colleges here offer only perl.

:(
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread Michael H. Goldwasser

On Thursday November 8, 2007, bhaaluu wrote: 

I asked if the source code for the textbook is available for download?
One of the best ways to judge the quality of a textbook is by the example
source code. I also asked if a sample chapter was available to read?
Sometimes an author's writing style just doesn't click (too bad for
students who HAVE TO buy the textbook for a class -- then they have
to suffer through it). But for others, studying on their own, being able
to read a sample chapter and look at the example source code might
be the stimulus to buy the book (even at $102/$71.53/$whatever).
OTOH, having a look at the example source, and a sample chapter
might be a good enough reason not to touch the book with a 10 foot
pole! It can go either way

Thats a great idea.  I'll contact our publisher today so that we can
get full source code from the entire book up on their website.  I'm
not sure of their willingness for a sample chapter, but will ask about
that as well.

With regard,
Michael


   +---+
   | Michael Goldwasser|
   | Associate Professor   |
   | Dept. Mathematics and Computer Science|
   | Saint Louis University|
   | 220 North Grand Blvd. |
   | St. Louis, MO 63103-2007  |
   |   |
   | Office: Ritter Hall 6 |
   | Email:  [EMAIL PROTECTED]  |
   | URL:euler.slu.edu/~goldwasser |
   | Phone:  (314) 977-7039|
   | Fax:(314) 977-1452|
   +---+

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread Alan Gauld
Michael H. Goldwasser [EMAIL PROTECTED] wrote

to suffer through it). But for others, studying on their own, 
 being able
to read a sample chapter and look at the example source code 
 might
be the stimulus to buy the book

 Thats a great idea.  I'll contact our publisher today so that we can
 get full source code from the entire book up on their website.  I'm
 not sure of their willingness for a sample chapter, but will ask 
 about
 that as well.

Its not an unusual thing - the Amazon Look Inside logo is widely
used and is usually more helpful than a hindrance in getting sales.
In fact the ideal for you is probably to try to get them to put the
sample chapter on Amazon because more folks will look there
than on the publisher's own web site!

If they are going to rely purely on academic sales then that will
greatly reduce their marketplace (and your royalties!)


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] From Numpy Import *

2007-11-08 Thread Dinesh B Vadhia
Thank-you!  It is important for us to avoid potential code conflicts and so 
we'll standardize on the import package name syntax.

On a related note: 
We are using both NumPy and SciPy.  Consider the example y = Ax where A is a 
sparse matrix.  If A is qualified as a scipy object then do y and x also have 
to be scipy objects or can they be numpy objects?

Dinesh


- Original Message - 
From: Michael H. Goldwasser 
To: Dinesh B Vadhia 
Cc: tutor@python.org 
Sent: Wednesday, November 07, 2007 5:37 PM
Subject: [Tutor] From Numpy Import *



On Wednesday November 7, 2007, Dinesh B Vadhia wrote: 

Hello!  The standard Python practice for importing modules is, for example:

import sys
import os
etc.

In NumPy (and SciPy) the 'book' suggests using:

from numpy import *
from scipy import *

However, when I instead use 'import numpy' it causes all sorts of errors 
 in my existing code.

The issue is the following.  The numpy module includes many definitions, for
example a class named array.   When you use the syntax,

   from numpy import *

That takes all definitions from the module and places them into your
current namespace.  At this point, it would be fine to use a command
such as 

  values = array([1.0, 2.0, 3.0])

which instantiates a (numpy) array.


If you instead use the syntax

   import numpy

things brings that module as a whole into your namespace, but to
access definitions from that module you have to give a qualified
name, for example as

  values = numpy.array([1.0, 2.0, 3.0])

You cannot simply use the word array as in the first scenario.  This
would explain why your existing code would no longer work with the
change.

What do you suggest?

The advantage of the from numpy import * syntax is mostly
convenience.   However, the better style is import numpy precisely
becuase it does not automatically introduce many other definitions
into your current namespace.

If you were using some other package that also defined an array and
then you were to use the from numpy import *, the new definition
would override the other definition.  The use of qualified names helps
to avoid these collisions and makes clear where those definitions are
coming from.

With regard,
Michael

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread Danyelle Gragsone
This is why I am going for programming instead of just CS. I am a very
hands on person.. although I know theory is good.. I just think it
needs to be evened out a bit :D.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread Alan Gauld
Chris Calloway [EMAIL PROTECTED] wrote

 teach languages. Teaching languages is frowned upon in some computer
 science departments under the logic that if you belong in a computer
 science class, you'd better show up for class already knowing 
 something
 as easy to grasp as an implementation language.

I don't like CS courses to focus on a language either, but neither do 
I think
we should expect students to already know one. But learning a computer
language should be a trivial exercise once you understand the CS 
concepts
of algorithms and data and I/O etc.

One of the worst things I find as an employer is the number of CS
grads I get to interview who insist they only know one language. I 
wonder
what they learned at college. That's like an electronics engineer 
saying
he only knows how to solder, or a civil engineer who only knows how
to lay bricks! A CS course should concentrate on principles and
theory and learning languages should be a practical detail that the
student does almost by osmosis.

And this is, of course, why my tutorial teaches three languages
not just python ;-)

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread wesley chun
 I wonder what schools offer python as a course.  Sadly all the
 colleges here offer only perl.

Danyelle's question brings up an issue i have, and that is that
courses in colleges are typically computer science courses, at least
at the university level.  there really aren't any programming
language courses, or at least, not when i was in college.  a regular
CS course is where you learn the fundamentals but then implement your
projects/homework in a chosen language (or 2), such as Java and
Scheme.

courses that *do* teach specific languages are usually electives and
not part of the core curriculum. one of the best things about Python,
as you are all aware, is that it is so diet, that students get to
focus on learning the key/core concepts of computer science without
getting bogged down by difficult syntax, data structure, or memory
mgmt issues.


On 11/8/07, bhaaluu [EMAIL PROTECTED] wrote:
 Another way to judge how the book is, is by reading the posts the author
 sends to THIS list in order to help people. Mr. Chun and Mr. Gauld are
 two authors who provide help on this list. I certainly don't mind if they
 advertise their books on occassion -- they are also Tutors!



just my $0.02,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Core Python Programming, Prentice Hall, (c)2007,2001
http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread christopher . henk
[EMAIL PROTECTED] wrote on 11/08/2007 05:19:59 PM:

 Chris Calloway [EMAIL PROTECTED] wrote
 
  teach languages. Teaching languages is frowned upon in some computer
  science departments under the logic that if you belong in a computer
  science class, you'd better show up for class already knowing 
  something
  as easy to grasp as an implementation language.
 
 I don't like CS courses to focus on a language either, but neither do 
 I think
 we should expect students to already know one. But learning a computer
 language should be a trivial exercise once you understand the CS 
 concepts
 of algorithms and data and I/O etc.
 
 One of the worst things I find as an employer is the number of CS
 grads I get to interview who insist they only know one language. I 
 wonder
 what they learned at college. That's like an electronics engineer 
 saying
 he only knows how to solder, or a civil engineer who only knows how
 to lay bricks! A CS course should concentrate on principles and
 theory and learning languages should be a practical detail that the
 student does almost by osmosis.
 
 And this is, of course, why my tutorial teaches three languages
 not just python ;-)
 
 -- 
 Alan Gauld
 Author of the Learn to Program web site
 http://www.freenetpages.co.uk/hp/alan.gauld

One of the worse things I found as a recent job hunter, was the number of 
employers who are not willing to accept that after completing a CS program 
that focuses on the science of CS, learning the language they are using is 
a trivial exercise.  On the plus side it helps identify the companies I 
didn't want to work for.

Chris Henk___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread wesley chun
apologies... meant to click the save now button but inadvertently
hit send instead...

 On 11/8/07, bhaaluu [EMAIL PROTECTED] wrote:
  Another way to judge how the book is, is by reading the posts the author
  sends to THIS list in order to help people. Mr. Chun and Mr. Gauld are
  two authors who provide help on this list. I certainly don't mind if they
  advertise their books on occassion -- they are also Tutors!

nah... that's a conflict of interest... the book can sell itself.  :-)
 *but* it surely doesn't hurt to ask alan to update his book to a 2nd
ed!  ;) *nudge*

-wesley
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New Introductory Book

2007-11-08 Thread Chris Calloway
Danyelle Gragsone wrote:
 I wonder what schools offer python as a course.

It has been rather widely publicized of late that MIT this year switched 
all their incoming computer science and electrical engineering students 
to Python (from Lisp) as their introductory programming language.

They use this well regarded $26.40 textbook:

http://www.amazon.com/Python-Programming-Introduction-Computer-Science/dp/1887902996/

There is a computer science department at my university. They don't 
teach languages. Teaching languages is frowned upon in some computer 
science departments under the logic that if you belong in a computer 
science class, you'd better show up for class already knowing something 
as easy to grasp as an implementation language. Some computer science 
courses at my university have an implementation language used in the 
class. I've noticed both Python and Lisp used.

-- 
Sincerely,

Chris Calloway
http://www.seacoos.org
office: 332 Chapman Hall   phone: (919) 962-4323
mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor