Python for Informatics (based on Think Python) featured on the Creative Commons Blog

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Python for Informatics (based on Think Python) featured on the Creative Commons Blog

csev
Here is the post about the book at Creative Commons:


"Chuck Severance, clinical professor at the University of Michigan’s School of Information, recently published a new textbook in 11 days because he was able to remix an existing textbook."

Here is my Blog post:


"It is quite natural for academics who are continuously told to ”publish or perish” to want to always create something from scratch that is their own contribution. This book is an for me experiment in ”re-mixing” an book titled Think Python: How to Think Like a Computer Scientist written by Allen B. Downey, Jeff Elkner and others."

Thanks to Jeff and Alan for making it possible and for letting me switch the copyright to CC-BY-Share Alike.

/Chuck Severance

_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Python for Informatics (based on Think Python) featured on the Creative Commons Blog

kirby urner-4

Another really excellent contribution!  I've just been perusing these first 10 chapters.

You're showing open source in action with respect to textbooks, not just source code.

A copyleft ecosystem in which teachers are explicitly encouraged to build on the contributions of peers is going to accelerate the availability of curriculum materials.

A few more comments off list...

Kirby


On Fri, Feb 5, 2010 at 9:10 AM, csev <[hidden email]> wrote:
Here is the post about the book at Creative Commons:


"Chuck Severance, clinical professor at the University of Michigan’s School of Information, recently published a new textbook in 11 days because he was able to remix an existing textbook."

Here is my Blog post:


"It is quite natural for academics who are continuously told to ”publish or perish” to want to always create something from scratch that is their own contribution. This book is an for me experiment in ”re-mixing” an book titled Think Python: How to Think Like a Computer Scientist written by Allen B. Downey, Jeff Elkner and others."

Thanks to Jeff and Alan for making it possible and for letting me switch the copyright to CC-BY-Share Alike.

/Chuck Severance

_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig



_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Python for Informatics (based on Think Python) featured on the Creative Commons Blog

csev
In reply to this post by csev

On Feb 5, 2010, at 9:31 PM, kirby urner wrote:

> What I'm not seeing here is any plans to venture into user-defined types
> i.e. rolling your own classes.

I am indeed tempted into user-defined types.  I actually teach OO Python in my App Engine course because it is necessary there.  And Think Python has a nice chapter.  But my problem is find a use case that drives me there in "exploring data" - I see using objects all over the place - but making your own does not yet feel part of the data narrative.

> That's maybe a line you draw between professional programmers and
> people who need to use computers a lot?

Right - and the other fun idea is that if "Python for Informatics" is the first book, then "Think Python" is the second book.   In a second book (which feels very similar to the first book) you learn how all this stuff "works".

I see in my crazy brain - a whole series of "Think Python" based books that feed into one another, all open content, and CC-BY-SA licensed all sharing basic text where needed.

Pure Intro books:

Learning Math with Python
Exploring Data with Python
... ???

The middle book:

Think like a Computer Scientist in Python

The More advanced books:

Web Programming in Python
Game Programming in Python
Building Graphical Tools with Python

The key is that the books could specialize on their topics and not over-teach in any of the books.  I know for example that you like to bring OO in for math - I don't think that is necessary (we can debate this forever :) ).  I would like to see a Python for math that actually taught Math - not teaching Python though math.  They can learn Python in the second course with "Think Python"

> The text reads like a gentle on-ramp to "core Python" at the moment,
> i.e. it's a very clear step by step intro.  So my prejudice as a reader
> is to think defining classes is just around the corner.

Yes - it would be the next chapter.

> I think there's a big "aha!" in Python when you've been using
> dot notation to access the methods of built-in types, e.g. strings,
> and then start to see how you're just hitting against pre-supplied
> class definitions.

Yes - and I love this - but the timing in the narrative must be right.  It cannot be a trap door - as much as we like it.  I have found in my App Engine course if I teach OO one week too early, I lose the students.   The pattern I now use successfully in my App Engine course is to make them use a real object with self and everything:

class LogoutHandler(webapp.RequestHandler):

  def get(self):
     ....

And the *next week* teach them classes - just using strings and dictionaries does not produce sufficient curiosity to learn classes.   A rich extension example with good pictures is the right preparation for a intro to classes - particularly if I keep saying "This syntax is a little new and we will explain it next week - just use it for now." instead of saying - "You must learn this now even though it is painful because next week we will be assuming this as a pre-requisite skill".

> Given how some of the library stuff involved with screen scraping
> might involve subclassing, maybe you're thinking to work it in under
> networked applications or one of those i.e. you have your wily ways.

Really?  Send me an example - I will work it in.  My thought for that chapter was to hack it as strings - where should I look for a better example?  I ma not an expert on this stuff and learn new things all the time.  Part of the fun of remixing Thin Python was learning a few new tricks along the way from Allen and Jeff.

/Chuck
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Transition to OOP

David MacQuigg
csev wrote:
> On Feb 5, 2010, at 9:31 PM, kirby urner wrote:
>  
>> What I'm not seeing here is any plans to venture into user-defined types
>> i.e. rolling your own classes.
>>    
>
> I am indeed tempted into user-defined types.  I actually teach OO Python in my App Engine course because it is necessary there.  And Think Python has a nice chapter.  But my problem is find a use case that drives me there in "exploring data" - I see using objects all over the place - but making your own does not yet feel part of the data narrative.
>  

Unless the course is *about* programming, I would delay user-defined
classes until you really feel the need.  Then there is no need to
motivate the extra complexity.  The benefits will be apparent.  I see
that Mathematics for the Digital Age does show an example of a class on
page 88, but I note that this is anecdotal information, not something
the students are expected to learn.

Fast forward six years.  I'm helping with a graduate course on
cryptography, and for the first time this semester felt the need for a
class definition.  I wrote a function to model an LFSR.  Then it became
apparent that I need more that just this one function, so I wrote a
class definition.  You can see the two side-by-side at
http://ece.arizona.edu/~edatools/ece596c/LFSR.html.

Even if the class will now do everything the function does and more, it
is still nice to study the function first, understand how the LFSR
works, then look at the more complex class definition.

************************************************************     *
* David MacQuigg, PhD    email: macquigg at ece.arizona.edu   *  *
* Research Associate                phone: USA 520-721-4583   *  *  *
* ECE Department, University of Arizona                       *  *  *
*                                 9320 East Mikelyn Lane       * * *
* http://purl.net/macquigg        Tucson, Arizona 85710          *
************************************************************     *

_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig
Reply | Threaded
Open this post in threaded view
|

Re: Transition to OOP

kirby urner-4
On Mon, Feb 8, 2010 at 3:33 PM, David MacQuigg <[hidden email]> wrote:

> csev wrote:
>>
>> On Feb 5, 2010, at 9:31 PM, kirby urner wrote:
>>
>>>
>>> What I'm not seeing here is any plans to venture into user-defined types
>>> i.e. rolling your own classes.
>>>
>>
>> I am indeed tempted into user-defined types.  I actually teach OO Python
>> in my App Engine course because it is necessary there.  And Think Python has
>> a nice chapter.  But my problem is find a use case that drives me there in
>> "exploring data" - I see using objects all over the place - but making your
>> own does not yet feel part of the data narrative.
>>
>
> Unless the course is *about* programming, I would delay user-defined classes
> until you really feel the need.  Then there is no need to motivate the extra
> complexity.  The benefits will be apparent.  I see that Mathematics for the
> Digital Age does show an example of a class on page 88, but I note that this
> is anecdotal information, not something the students are expected to learn.
>

Yeah, I think I'm ready to throw in the towel on this one.

I know there's this Standard Library class, an XML parser or something,
that you subclass and run against an HTML file say.  You write methods
for if it's a <div> tag, a <p> tag or whatever (<span></span>?).  You
basically script out this catcher's mitt, that listens on tags.

OK, so I went looking for it in urllib2, and gave up.  Why?  Because
in talking to my company president friend, who hacks a LAMP stack
and filters through HTML (energy biz focus), I learned that people
use Beautiful Soup, and you don't need to know subclassing for that.

So for Dr. Chuck's specific book and application, I'm thinking he's right
to be skeptical and you're right to back him up.

Regarding Litvins pg. 88, yeah that's somewhat anecdotal in that
there's a reduce function mentioned, but not provided.  It'd normally
involve GCD (we're reducing to lowest terms by factoring out the
greatest common denominator) but that function doesn't come
until the RSA section at the end of the book.  So this is not
necessarily the proper place to start in with the basics of OO.

So I'd posit something more like the gentle introduction to Classes
on Wikieducator, that simple intro at the end (PSF_Snake demo).
This would be in a different book in a different course, probably
with MFDA still on ahead for a lot of those taking it.

A prime motivation for user defined types is of course operator
overloading (what page 88 illustrates).  This is a math course
so when we add 3/4 and 5/8, we'd like to use syntax as natural
and familiar as (3/4) + (5/8), as this reminds us we're working
with ordinary Fractions (using an executable notation).

Unlike many languages, Python makes this feature unusually
easy (Ruby too), so we learn just enough about OO to get
that working.  We're not in MRO country, not doing multiple
inheritance.  We're just figuring out what makes Rational
Numbers tick, which is why a skilled teacher might use Litvins
page 88 as a fun touch stone.  We get to it already knowing
about GCD, as Euclid's Method came earlier, plus we've been
through all that Dog, Monkey, Mammal stuff and don't find
the notation that alien any more (yet we're not Python black
belts, would still need more CS, then maybe Java, so many
paths possible).

Re MFDA 2nd edition pg 89:

Note how f1 + f2 i.e. f1 .__add__(f2) is an argument to the
format function and being fed to a string.  The + sign is
triggering the __add__ in other words (the only operator
implemented on pg. 88, more a sketch than working code).
Not complaining.  MFDA is a perfectly legitimate slice through
a vast topic space.  Design decisions were made.  Not
much use of a turtle either, or polyhedra.  Can't do everything
in one slim tome.  That's why we need (and have) lots of
books, more on the way, some of 'em wikis.

Anyway in this case it's not that it's a course about
programming, so much as it's a course about "types of math
object" and what makes them tick.  Vectors, Polyhedra,
Polynomials... those things that they teach you about
with or without computers, on the scene long before OO.
Some courses just take advantage of some newer tools.
Mathematica?  GameMaker?  Depends on the catalog.

A Computational Thinking class is not identically a
Bioinformatics class, which latter might be more about
filtering through reams of data (or a Shakespeare play),
a perfectly valid and reasonable use of a scripting
language, one of the best use cases out there.  Python
is very appropriate for this, as the text cleverly shows.

So yeah (throwing in the towel) maybe there's no great
use case for getting into user-defined types.

Here's a valid reason to branch off an excellent beginning
of How To Think Like a Computer Scientist, and to take
it in some other direction.  More with Regular Expressions
perhaps, talking to databases.  A tree of alternatives
naturally grows here.

That's what open source curriculum writing should
encourage, not everyone rewriting the same book.  We'll
go off in our different directions and compare notes where
paths cross.

> Fast forward six years.  I'm helping with a graduate course on cryptography,
> and for the first time this semester felt the need for a class definition.
>  I wrote a function to model an LFSR.  Then it became apparent that I need
> more that just this one function, so I wrote a class definition.  You can
> see the two side-by-side at
> http://ece.arizona.edu/~edatools/ece596c/LFSR.html.
>
> Even if the class will now do everything the function does and more, it is
> still nice to study the function first, understand how the LFSR works, then
> look at the more complex class definition.
>

Coolness.  Fun to think about crypto some more.

I did a bunch of pages on crypto, starting with an implementation of Blowfish,
linking to Neal Stephenson's book Cryptonomicon.  I went on to provide a
gentle build up to RSA that's pretty comprehensible.

http://www.4dsolutions.net/ocn/crypto0.html

If you check, you'll see I stay at the function level in the first section,
but have some Permutation class going already by section two.  This
isn't their first exposure to Python, lets assume.  We're more like at
the end of MFDA, when they're ready to tackle RSA -- which is what
I get to as well, maybe by a different route.

Lots of teachers with web sites like this, showing off different ways
to parse out the topics.  Not saying the way I'm providing is best or
only, just another.  I made lots of cool graphics, mostly with POV-Ray.
Even embedded a Java applet or two (I take some pride in my work,
as one would hope).

Now Patrick, my company president friend, does roll his own classes
i.e. he's found the programmer's need for them.  He uses the unit
testing framework.  He likes to encapsulate.  But when he paws
through HTML files, I think he's basically just using beautifulsoup,
why reinvent that wheel?

Sounds like we're all in agreement?

Conclusion:  a lot depends on what use cases you're wanting to
cover.  Too many use cases to cover them all.  So pick and choose,
teach accordingly.  Sounds like a plan.

Kirby Urner
4D Solutions
Portland, Oregon


> ************************************************************     *
> * David MacQuigg, PhD    email: macquigg at ece.arizona.edu   *  *
> * Research Associate                phone: USA 520-721-4583   *  *  *
> * ECE Department, University of Arizona                       *  *  *
> *                                 9320 East Mikelyn Lane       * * *
> * http://purl.net/macquigg        Tucson, Arizona 85710          *
> ************************************************************     *
_______________________________________________
Edu-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/edu-sig