Re: Do any of you recommend Python as a first programming language?

2008-03-26 Thread Simon Brunning
On Sun, Mar 23, 2008 at 4:29 AM, Steven D'Aprano
[EMAIL PROTECTED] wrote:

  Python is a programming language. It can be used for scripting, but
  that's not all it can do. Describing it as a scripting language is like
  describing a fully-equipped professional kitchen as a left-over warming
  room.

+1 QOTW.

-- 
Cheers,
Simon B.
[EMAIL PROTECTED]
http://www.brunningonline.net/simon/blog/
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Do any of you recommend Python as a first programming language?

2008-03-26 Thread Delaney, Timothy (Tim)
Steven D'Aprano wrote:

 On Sat, 22 Mar 2008 21:11:51 -0700, sturlamolden wrote:
 
 Yes. And because Python is a scripting language
 
 
 Python is a programming language. It can be used for scripting, but
 that's not all it can do. Describing it as a scripting language is
 like describing a fully-equipped professional kitchen as a left-over
 warming room.

I'm putting words in sturlamolden's mouth here, but I think he was
implying that Python has all the advantages of a scripting language,
hence has a much gentler introduction than many fully-fledged
programming languages (and indeed, many scripting languages).

Cheers,

Tim Delaney
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: Do any of you recommend Python as a first programming language?

2008-03-26 Thread Carnell, James E

I vote a strong yes! I went through a MIS major and learned java first.
This was a disaster for me typing these long nonsense lines (I didn't
understand how classes and their members worked). Next was C and we had
to use a command line and notepad to do all our programs. I really
didn't learn much. After I graduated a friend told me to try python
since I had this screw programming attitude. Actually I really did
want to program. The fact that I could type one liners in without having
to do make files and all that actually made it feasible for me to learn.
I learned more from python and the tutorial list than 4 years of
college. I really am serious!

I'm going back now and learning C++ and might be able to learn crystal
space 3d here before too long. 

James Carnell


Steven D'Aprano wrote:

 On Sat, 22 Mar 2008 21:11:51 -0700, sturlamolden wrote:
 
 Yes. And because Python is a scripting language
 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread John Nagle
Paul Rubin wrote:
 Jeff Schwab [EMAIL PROTECTED] writes:
 I've been learning a fair amount about functional programming
 recently, mostly because compile-time C++ turns out to be a pure
 functional programming language.  Where should I go for a solid
 grounding in lambda-calculus?
 
 For PL theory in general, try this:
 
 http://www.cs.cmu.edu/~rwh/plbook/book.pdf

 What a mess.  That's some professor inventing his very own variation on
predicate calculus and writing a book using his own notation and terminology.
There's no sign of footnotes or references to prior work.  The notation
doesn't seem to do anything not previously possible; it's just different.

 Back when I was doing program verification work, we used to refer to
stuff like that as the logic of the month club.

John Nagle
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Paul Rubin
John Nagle [EMAIL PROTECTED] writes:
  What a mess.  That's some professor inventing his very own variation on
 predicate calculus and writing a book using his own notation and terminology.

I thought it was all pretty standard.  It's the same notation I see in
other PL stuff.

 There's no sign of footnotes or references to prior work.

Maybe he'll add that.  It's a work in progress.  

  Back when I was doing program verification work, we used to refer to
 stuff like that as the logic of the month club.

I thought the book was pretty good and I've learned quite a bit from
the parts I've read.  Also, the author is one of the big cheeses in
the SML world, if that matters.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Steven D'Aprano
On Sat, 22 Mar 2008 23:15:00 -0700, John Nagle wrote:

 That's some professor inventing his very own variation on predicate
 calculus and writing a book using his own notation and terminology.
 There's no sign of footnotes or references to prior work.  The notation
 doesn't seem to do anything not previously possible; it's just
 different.

You say that as if it were unusual in maths circles :)

-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Berco Beute
On Mar 22, 5:40 pm, jmDesktop [EMAIL PROTECTED] wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.

 Thank you.

Yes. The nice thing with Python is that you can start off with really
simple examples and slowly build up the complexity along with the
understanding of the students. There's no need to explain OO before
the students can write their first 'Hello, world'.

There's almost no limit to how 'shallow/deep' you can go with Python.

2B
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Arnaud Delobelle
On Mar 23, 8:14 am, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
 On Sat, 22 Mar 2008 23:15:00 -0700, John Nagle wrote:
  That's some professor inventing his very own variation on predicate
  calculus and writing a book using his own notation and terminology.
  There's no sign of footnotes or references to prior work.  The notation
  doesn't seem to do anything not previously possible; it's just
  different.

 You say that as if it were unusual in maths circles :)


Haha.  As opposed to programmers who have all agreed to use the same
language.

Anyway, I have browsed the book and agree with Paul Rubin that there
doesn't seem to be any unusual notation in it, although there are a
numbers of topics that I am not really familiar with.

--
Arnaud

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Ben C
On 2008-03-22, bsoist [EMAIL PROTECTED] wrote:
 On Mar 22, 12:40 pm, jmDesktop [EMAIL PROTECTED] wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.

 Thank you.

 Absolutely. I love using Python in the real world but it is
 fantastic for beginning programmers.

 Python enforces good habits and presents many opportunities to discuss
 programming from an academic perspective. Why does Python not have a
 switch or until statement?

Why doesn't it?

 Why are very common objects (stack, queue,
 linked list) not builtin? etc.

I think I know this one: you just use builtin lists to do stacks, queues
and, er, lists.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Martin P. Hellwig
jmDesktop wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.
 
 Thank you.

I for one can't really answer this question but I wanted to share the 
reason for that :-) since I worked in the dutch high school equivalent 
for a number of years.

First and most important is I think the objective you want to reach, at 
my school we had a number of angles:
- A math teacher using it as a simpler way of writing examples and 
explanation while being able to let the students see what is going on 
and why.
- A basic grade computer introduction, to let them feel what automation 
is about, more like the philosophy of it.
- A higher grade computer science (well for high school that is) 
introduction in to programming.
- A explanation what makes the computer tick and how it does it (cpu 
architecture, memory management etc.)

In my opinion python is extremely useful for all of these objectives, 
except for the last one, this would be more a job for assembler. My 
school decided not to go in depth to that because we felt it would be 
out of reach for the majority of the students and we didn't wanted to 
spoil the students when they decide to take up CS in university later on.


-- 
mph






-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Dustan
On Mar 22, 10:40 am, jmDesktop [EMAIL PROTECTED] wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.

Yes.

 Thank you.

You're welcome.
-- 
http://mail.python.org/mailman/listinfo/python-list


Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Aahz
In article [EMAIL PROTECTED],
Jeff Schwab  [EMAIL PROTECTED] wrote:

Also, despite reassurances to the contrary, I still get the impression 
that there is a strong anti-lambda sentiment among the Python in 
crowd.  Is it just a question of the word lambda, as opposed to 
perceived cleaner syntax?

The problem with lambda is that too often it results in clutter (this is
a strictly made-up example off the top of my head for illustrative
purposes rather than any real code, but I've seen plenty of code similar
at various times):

gui.create_window(origin=(123,456), background=gui.WHITE, 
foreground=gui.BLACK, callback=lambda x: x*2)

That means I need to pause reading the create_window() arguments while I
figure out what the lambda means -- and often the lambda is more
complicated than that.  Moreover, because the lambda is unnamed, it's
missing a reading cue for its purpose.
-- 
Aahz ([EMAIL PROTECTED])   * http://www.pythoncraft.com/

It is easier to optimize correct code than to correct optimized code.
--Bill Harlan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread George Sakkis
On Mar 23, 12:24 pm, [EMAIL PROTECTED] (Aahz) wrote:

 The problem with lambda is that too often it results in clutter (this is
 a strictly made-up example off the top of my head for illustrative
 purposes rather than any real code, but I've seen plenty of code similar
 at various times):

 gui.create_window(origin=(123,456), background=gui.WHITE,
 foreground=gui.BLACK, callback=lambda x: x*2)

 That means I need to pause reading the create_window() arguments while I
 figure out what the lambda means -- and often the lambda is more
 complicated than that.  Moreover, because the lambda is unnamed, it's
 missing a reading cue for its purpose.

In a sense the lambda here is not unnamed; it's name is the name of
the keyword argument, 'callback', which is indeed a poor name at in
terms of self-documentation. I don't see how replacing the lambda with
a (better) named function would be any better than using the same name
as a keyword parameter.

George
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Steven D'Aprano
On Sun, 23 Mar 2008 09:24:35 -0700, Aahz wrote:

 The problem with lambda is that too often it results in clutter (this is
 a strictly made-up example off the top of my head for illustrative
 purposes rather than any real code, but I've seen plenty of code similar
 at various times):
 
 gui.create_window(origin=(123,456), background=gui.WHITE,
 foreground=gui.BLACK, callback=lambda x: x*2)
 
 That means I need to pause reading the create_window() arguments while I
 figure out what the lambda means -- and often the lambda is more
 complicated than that.  Moreover, because the lambda is unnamed, it's
 missing a reading cue for its purpose.


And of course this would be so much better:

def double(x): return x*2

gui.create_window(origin=(123,456), background=gui.WHITE,
foreground=gui.BLACK, callback=double)


Not.

The source of the clutter (having *less* code is clutter???) and 
confusion isn't the lambda, it's the callback.



-- 
Steven



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Roy Smith
 Also, despite reassurances to the contrary, I still get the impression 
 that there is a strong anti-lambda sentiment among the Python in 
 crowd.  Is it just a question of the word lambda, as opposed to 
 perceived cleaner syntax?

There is a fundamental disharmony in how functions and other objects are 
treated in Python.  If I say:

x = ['surprise', 'fear', 'ruthless efficiency']

I've done two things.  First, I've created a list, then I've bound the name 
x to that list (maybe bound is not exactly the right terminology).  Until 
the assignment happend, the list had no name.  In fact, it still has no 
name; there's just a reference to it stored in a variable whose name is x.  
If I were to then do

y = x

now y and x have equal relationships to the original list.  The list's name 
is no more x than it is y, since the whole concept of the name of the 
list doesn't have any meaning in Python.

On the other hand, when I do:

def torture():
woman.putInChair()
cushion.poke()
rack.turn()

I've also done two things.  First, I've created a function object (i.e. a 
lambda body), and I've also bound the name torture to that function object, 
in much the same way I did with the list.  But, it's different.  The 
function object KNOWS that it's name is torture.  When I later reassign it 
to another name and run it:

weapon = torture
weapon()

This is what I get:

Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 2, in torture
NameError: global name 'woman' is not defined

Notice, the second line in the stack trace identified the function's name 
as torture, not weapon.  Because that IS the function's name.  Lists 
are anonymous.  Functions have names (as do a few other things like classes 
and modules).  If I ask a list what its name is, I get:

AttributeError: 'list' object has no attribute '__name__'

but, if I ask a function what it's name is (regardless of what name I've 
bound it to), I get the right answer:

 torture.__name__
'torture'
 weapon.__name__
'torture'
 

If we created lisp-like lambdas and bound them to names like we did with 
other types of objects, we wouldn't have that.

What Python give us with lambdas is some half-way thing.  It's not a full 
function, so it's something that people use rarely, which means most people 
(like me) can't remember the exact syntax.  Even when I know it's the right 
thing to be using in a situation, I tend not to use it simply because the 
path of least resistance is to write a one-off function vs. looking up the 
exact syntax for a lambda in the manual.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Fuzzyman
On Mar 23, 4:24 pm, [EMAIL PROTECTED] (Aahz) wrote:
 In article [EMAIL PROTECTED],
 Jeff Schwab  [EMAIL PROTECTED] wrote:



 Also, despite reassurances to the contrary, I still get the impression
 that there is a strong anti-lambda sentiment among the Python in
 crowd.  Is it just a question of the word lambda, as opposed to
 perceived cleaner syntax?

 The problem with lambda is that too often it results in clutter (this is
 a strictly made-up example off the top of my head for illustrative
 purposes rather than any real code, but I've seen plenty of code similar
 at various times):

 gui.create_window(origin=(123,456), background=gui.WHITE,
 foreground=gui.BLACK, callback=lambda x: x*2)

 That means I need to pause reading the create_window() arguments while I
 figure out what the lambda means -- and often the lambda is more
 complicated than that.  Moreover, because the lambda is unnamed, it's
 missing a reading cue for its purpose.


I find lambdas invaluable very frequently - often to avoid the reading
clutter.

* Transforming function calls

something.Event += lambda sender, event: real_handler()

* Properties

name = property(lambda self: self.__name, __set_name)

* Very short functions where extra lines reduce readability

if direction == 'left':
transform = lambda x, y: -x
else:
transform = lambda x, y: x

* Functions that take functions as arguments

old_list = [(3,1), (2, 2), (1, 3)]
new_list = sorted(old_list, key=lambda x: x[1])

new_data = process(data_Set, lambda x: x+1)
new_data2 = process(data_Set, lambda x: x-1)


I don't think any of these are unreadable or improved by defining a
'real' function.

Michael
http://www.ironpythoninaction.com

 --
 Aahz ([EMAIL PROTECTED])   *http://www.pythoncraft.com/

 It is easier to optimize correct code than to correct optimized code.
 --Bill Harlan

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Fuzzyman
On Mar 22, 6:40 pm, Jeff Schwab [EMAIL PROTECTED] wrote:
 jmDesktop wrote:
  For students 9th - 12th grade, with at least Algebra I.  Do you think
  Python is a good first programming language for someone with zero
  programming experience?  Using Linux and Python for first exposure to
  programming languages and principles.

 Linux and Python are a nearly ideal combination for this.  Be aware that
 at some point, you will likely have to dig into C, the primary language
 used to implement both Linux and Python.

I've been using Python for five years and now work full-time as a
Python programmer. I've not had to hit C. :-)

Michael Foord
http://www.ironpythoninaction.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Steven D'Aprano
On Sun, 23 Mar 2008 13:51:34 -0400, Roy Smith wrote:

 On the other hand, when I do:
 
 def torture():
 woman.putInChair()
 cushion.poke()
 rack.turn()
 
 I've also done two things.  First, I've created a function object (i.e.
 a lambda body), and I've also bound the name torture to that function
 object, in much the same way I did with the list.  But, it's different. 
 The function object KNOWS that it's name is torture.

No it does not. Function objects don't know their name. All they know is 
that they have a label attached to them that is useful to use as a name 
in some contexts, e.g. when printing tracebacks. It's just a label, 
nothing more.

You can prove that for yourself with a few simple tests. Firstly, we can 
prove that functions don't know what they are called by writing a 
recursive function:


def spam(n):
if n = 1: return Spam
return Spam  + spam(n-1)


If spam() knows what it is called, then you should be able to rename the 
function and the recursive call will continue to work. But in fact, 
that's not what happens:


 spam(3)  # check that it works
'Spam Spam Spam'
 tasty_stuff = spam  # make an alias
 tasty_stuff(3)
'Spam Spam Spam'


But now watch what happens when we create a new function with the name 
spam. It hijacks the recursive call:


 def spam(n):
... return ham-like meat product
...
 tasty_stuff(3)
'Spam ham-like meat product'

The function formerly known as spam isn't calling itself, it is merely 
calling a function by name spam. But we can see that the function 
tasty_stuff() is still using the old spam label for itself:

 tasty_stuff('foo')
Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 3, in spam
TypeError: unsupported operand type(s) for -: 'str' and 'int'


Unfortunately there's nothing we can do to fix that error. Even though 
the function object has an attribute __name__ (also known as 
func_name) which is set to spam, it isn't used for tracebacks. Instead, 
the label comes from a read-only attribute buried deep in the function 
object:

 tasty_stuff.func_code.co_name = 'yummy meat-like product in a can'
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: readonly attribute


This is a mistake, in my opinion. It's an arbitrary decision to make this 
read-only (as far as I can tell), which goes against the grain of 
Python's we're all consenting adults here philosophy.

By the way, in case you're thinking that wanting to change the (so-
called) name of a function is a silly think to do, not at all. Consider 
factory functions:

def factory(how_much):
def f(n=1):
for i in range(n):
print I love spam a %s % how_much
return f

Every function created by the factory has the same name, no matter what 
name you actually use to refer to it. factory('little') and 
factory('lot') both uselessly identify themselves as f in tracebacks.

The truth is that objects don't know what name they have, because objects 
don't have names. The relationship is the other way around: names have 
objects, not vice versa. Some objects (functions, classes, anything 
else?) usefully need a label so that they can refer to themselves in 
tracebacks and similar, and we call that label the name, but it's just 
a label. It doesn't mean anything.


[snip]

 What Python give us with lambdas is some half-way thing.  It's not a
 full function, so it's something that people use rarely, 

Which people?

 which means most people (like me) can't remember the exact syntax. 

Speak for yourself, not for most people.


 Even when I know
 it's the right thing to be using in a situation, I tend not to use it
 simply because the path of least resistance is to write a one-off
 function vs. looking up the exact syntax for a lambda in the manual.

lambda arguments : expression

Why is that harder to remember than this?

def name ( arguments ) :
block  

And don't forget to include a return statement, or you'll be surprised by 
the result of the function.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-23 Thread Kay Schluehr
On 23 Mrz., 09:31, Arnaud Delobelle [EMAIL PROTECTED] wrote:
 On Mar 23, 8:14 am, Steven D'Aprano [EMAIL PROTECTED]

 cybersource.com.au wrote:
  On Sat, 22 Mar 2008 23:15:00 -0700, John Nagle wrote:
   That's some professor inventing his very own variation on predicate
   calculus and writing a book using his own notation and terminology.
   There's no sign of footnotes or references to prior work.  The notation
   doesn't seem to do anything not previously possible; it's just
   different.

  You say that as if it were unusual in maths circles :)

 Haha.  As opposed to programmers who have all agreed to use the same
 language.

 Anyway, I have browsed the book and agree with Paul Rubin that there
 doesn't seem to be any unusual notation in it, although there are a
 numbers of topics that I am not really familiar with.

 --
 Arnaud

The author at least introduces his notation in the initial chapter.
This is good style among mathematicians who introduce conventions at
the beginning of their books or in an appendix.

Note that I'm with Paul here but I'm not sure what John is complaining
about anyway. Maybe sequent calculus ( natural deduction ) which was
introduced by Gentzen around 75 years ago?

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

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Roy Smith
Steven D'Aprano [EMAIL PROTECTED] wrote:

 On Sun, 23 Mar 2008 13:51:34 -0400, Roy Smith wrote:
 
  On the other hand, when I do:
  
  def torture():
  woman.putInChair()
  cushion.poke()
  rack.turn()
  
  I've also done two things.  First, I've created a function object (i.e.
  a lambda body), and I've also bound the name torture to that function
  object, in much the same way I did with the list.  But, it's different. 
  The function object KNOWS that it's name is torture.
 
 No it does not. Function objects don't know their name. All they know is 
 that they have a label attached to them that is useful to use as a name 
 in some contexts, e.g. when printing tracebacks. It's just a label, 
 nothing more.

I think we're arguing the same thing.  When you write

def foo():
   whatever

you create an object which contains the string foo, retrievable through 
its __name__ attribute.  That's what I meant by it knows its name

 What Python give us with lambdas is some half-way thing.  It's not a
 full function, so it's something that people use rarely, 
 
 Which people?
 
  which means most people (like me) can't remember the exact syntax. 
 
 Speak for yourself, not for most people.

Well, OK.  When I said, most people, I really meant I know about me, and 
I'm guessing about other people.  I still think it's a fair statement that 
if you look any large collection of Python code, you will find many more 
uses of def than of lambda.

  Even when I know
  it's the right thing to be using in a situation, I tend not to use it
  simply because the path of least resistance is to write a one-off
  function vs. looking up the exact syntax for a lambda in the manual.
 
 lambda arguments : expression
 
 Why is that harder to remember than this?
 
 def name ( arguments ) :
 block  

because I remember things I use often, better than I remember things I use 
infrequently.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why I hate lambdas (Re: Do any of you recommend Python as a first programming language?)

2008-03-23 Thread Steven D'Aprano
On Sun, 23 Mar 2008 22:36:35 -0400, Roy Smith wrote:

  I've also done two things.  First, I've created a function object
  (i.e. a lambda body), and I've also bound the name torture to that
  function object, in much the same way I did with the list.  But, it's
  different. The function object KNOWS that it's name is torture.
 
 No it does not. Function objects don't know their name. All they know
 is that they have a label attached to them that is useful to use as a
 name in some contexts, e.g. when printing tracebacks. It's just a
 label, nothing more.
 
 I think we're arguing the same thing.  When you write
 
 def foo():
whatever
 
 you create an object which contains the string foo, retrievable
 through its __name__ attribute.  That's what I meant by it knows its
 name


But that's not true. Firstly, you can't access the __name__ attribute 
unless you already have a reference to the object (not necessarily a 
name), so clearly the __name__ attribute isn't how you retrieve objects.

Secondly, the __name__ attribute has no special purpose. It's not even 
used for tracebacks.


 def foo():
... return result
...
 foo.__name__ = something
 something()
Traceback (most recent call last):
  File stdin, line 1, in module
NameError: name 'something' is not defined
 
 something = foo
 something()
'result'
 something(None)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: foo() takes no arguments (1 given)
 something.__name__
'something'


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Do any of you recommend Python as a first programming language?

2008-03-22 Thread jmDesktop
For students 9th - 12th grade, with at least Algebra I.  Do you think
Python is a good first programming language for someone with zero
programming experience?  Using Linux and Python for first exposure to
programming languages and principles.

Thank you.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread André
On Mar 22, 1:40 pm, jmDesktop [EMAIL PROTECTED] wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.

 Thank you.
Yes.

You'll probably get 100 positive answers!

Check out the edu-sig mailing list for discussions on the topic.  And
you may want to check out rur-ple.sourceforge.net, where ple stands
for Python Learning Environment.

André
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Jeff Schwab
jmDesktop wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.

Linux and Python are a nearly ideal combination for this.  Be aware that 
at some point, you will likely have to dig into C, the primary language 
used to implement both Linux and Python.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Arnaud Delobelle
jmDesktop [EMAIL PROTECTED] writes:

 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.

I'm not from the US and I'm not sure what 9th/12th grade are, but if
you want to use programming to explore maths, er I mean math, have a
look at the sage project:

http://www.sagemath.org/

-- 
Arnaud
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Larry Bates
jmDesktop wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.
 
 Thank you.

ABSOLUTELY.  Get them started with a REAL programming language that will
teach them proper fundamentals.  I wish Python would have been around 25
years ago when I taught incoming Freshmen at local University.  To get
students to understand about variable references, etc. I always started
them with Assembler so they could understand what was actually going on.
I see so may on this forum that have the wrong ideas about variable names/
storage.

Good Luck,
Larry Bates
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Jeff Schwab
Larry Bates wrote:
 jmDesktop wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.

 Thank you.
 
 ABSOLUTELY.  Get them started with a REAL programming language that will
 teach them proper fundamentals.  I wish Python would have been around 25
 years ago when I taught incoming Freshmen at local University.  To get
 students to understand about variable references, etc.

What do you mean by variable references, and how are they used in Python?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread André
On Mar 22, 3:48 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
 jmDesktop [EMAIL PROTECTED] writes:
  For students 9th - 12th grade, with at least Algebra I.  Do you think
  Python is a good first programming language for someone with zero
  programming experience?  Using Linux and Python for first exposure to
  programming languages and principles.

 I'm not from the US and I'm not sure what 9th/12th grade are, but if
 you want to use programming to explore maths, er I mean math, have a
 look at the sage project:


9th grade roughly corresponds to 3e collège and 10th/12th grade
roughly correspond to the first three years of le lycée - although
from my past teaching experience (as a physicist) in French, I have
concluded that mathematics is taught at a higher level in France than
it is in North America - simply looking at the various books available
on given topics.

 http://www.sagemath.org/

Sage is great.  However, I think it is much too advanced for 9th/12th
grade. Furthermore, the OP was looking for suggestion teaching
*programming*, not math.

André

 --
 Arnaud

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Brian Lane
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jeff Schwab wrote:
 jmDesktop wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.
 
 Linux and Python are a nearly ideal combination for this.  Be aware that 
 at some point, you will likely have to dig into C, the primary language 
 used to implement both Linux and Python.

At that level I don't see why they would need to hit 'C' at all. Maybe
some of the APIs, but not syntax at all.

I would consider Python an ideal language for HS students to learn. The
teacher who hosts our KPLUG meetings has had good luck using Python in
her classes.

Brian

- --
- ---[Office 67.9F]--[Outside 49.1F]--[Server 104.7F]--[Coaster 67.1F]---
- ---[  KLAHOWYA WSF (366773110) @ 47 31.2076 -122 27.2249  ]---
Software, Linux, Microcontrollers http://www.brianlane.com
AIS Parser SDKhttp://www.aisparser.com
Movie Landmarks Search Enginehttp://www.movielandmarks.com

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Remember Lexington Green!

iD8DBQFH5VWZIftj/pcSws0RAoouAJ45UaRYDxwjwNLC8KblaFfyEKz3kACfeeWV
XREAe/+tjyYuTVZOrNtaObE=
=9h+S
-END PGP SIGNATURE-
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Paul Rubin
jmDesktop [EMAIL PROTECTED] writes:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?

It's at least pretty good.  It's not ideal, but nothing ever is.

What I mean is: it's the best suggestion I can think of, but I can't
say with confidence that there's nothing better out there.
Alternatives would probably be more esoteric languages like Logo.

Chris Okasaki (of functional data structures fame) has an interesting
blog post about why indentation-based structuring is a big help for
teaching:

http://okasaki.blogspot.com/2008/02/in-praise-of-mandatory-indentation-for.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Arnaud Delobelle
On Mar 22, 7:00 pm, Larry Bates [EMAIL PROTECTED] wrote:
 jmDesktop wrote:
  For students 9th - 12th grade, with at least Algebra I.  Do you think
  Python is a good first programming language for someone with zero
  programming experience?  Using Linux and Python for first exposure to
  programming languages and principles.

  Thank you.

 ABSOLUTELY.  Get them started with a REAL programming language that will
 teach them proper fundamentals.  I wish Python would have been around 25
 years ago when I taught incoming Freshmen at local University.  To get
 students to understand about variable references, etc. I always started
 them with Assembler so they could understand what was actually going on.
 I see so may on this forum that have the wrong ideas about variable names/
 storage.

It's funny, 25 years ago - I was 10 then - I got my first computer
from my cousin (a Sinclair ZX81, I think it had a different name in
the US) as he was getting a brand new C64.  In those days BASIC was
very slow so if you wanted to do anything demanding with a computer
you had to learn 'machine language' (I didn't have an assembler...).
I wrote my little programs in a notebook, then POKEd them into
memory!  I learnt so much then.  Years later, when I got my first C
compiler, it was a liberation.

My other 'coming of age' was when I took a lambda-calculus course at
university.  I felt like a man who's had a black and white TV set all
his life and watches colour TV for the first time.  What if computers
had been designed as 'lambda-calculus machines' from the start rather
than Turing machines?

Anyway, here the conclusion that I draw: learn lambda-calculus and
Turing machines.  The rest is syntactic sugar.

Not quite seriously but still'ly yours
--
Arnaud

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Jeff Schwab
Arnaud Delobelle wrote:

 Anyway, here the conclusion that I draw: learn lambda-calculus and
 Turing machines.  The rest is syntactic sugar.

How is the lambda-calculus fundamentally different from Turing 
machine-based implementations?

I've been learning a fair amount about functional programming recently, 
mostly because compile-time C++ turns out to be a pure functional 
programming language.  Where should I go for a solid grounding in 
lambda-calculus?

Also, despite reassurances to the contrary, I still get the impression 
that there is a strong anti-lambda sentiment among the Python in 
crowd.  Is it just a question of the word lambda, as opposed to 
perceived cleaner syntax?

http://www.artima.com/weblogs/viewpost.jsp?thread=98196
http://www.python.org/dev/peps/pep-0290/#replacing-common-uses-of-lambda

-- 
Said the Rabbi Hillel, All the rest is commentary.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread bsoist
On Mar 22, 12:40 pm, jmDesktop [EMAIL PROTECTED] wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.

 Thank you.

Absolutely. I love using Python in the real world but it is
fantastic for beginning programmers.

Python enforces good habits and presents many opportunities to discuss
programming from an academic perspective. Why does Python not have a
switch or until statement? Why are very common objects (stack, queue,
linked list) not builtin? etc.

I have seen 14 and 15 year old students who have never done any
programming begin to write real object oriented programs after 60
hours or so of classroom instruction.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread 7stud
On Mar 22, 3:34 pm, bsoist [EMAIL PROTECTED] wrote:
 On Mar 22, 12:40 pm, jmDesktop [EMAIL PROTECTED] wrote:

  For students 9th - 12th grade, with at least Algebra I.  Do you think
  Python is a good first programming language for someone with zero
  programming experience?  Using Linux and Python for first exposure to
  programming languages and principles.

  Thank you.

 Absolutely. I love using Python in the real world but it is
 fantastic for beginning programmers.

 Python enforces good habits and presents many opportunities to discuss
 programming from an academic perspective. Why does Python not have a
 switch or until statement? Why are very common objects (stack, queue,
 linked list) not builtin? etc.


Beginning programmers in grades 9-12 are not going to understand
issues like that, and it would be a mistake to try and introduce
them.  Beginning programmers should be concentrating their efforts on
learning the syntax of a language and basic constructs like for-loops
and if statements.  They will begin by writing simple hello world
style programs, and as their basic skills improve, the programs will
get a little more complex and require some more thought and some math
to solve the problems presented to them.  String formatting should
probably be introduced to help with formatting the output.  That is
about as far as things are going to go.

Terms like Touring machines and lambda-calculus are not going to
be mentioned anywhere in the course of study.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Paul McGuire
On Mar 22, 11:40 am, jmDesktop [EMAIL PROTECTED] wrote:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.

 Thank you.

I absolutely support Python as a first programming language, from 7th
grade on up.  Here is a link at the main Python web site that should
give you a number of additional resources: 
http://www.python.org/community/sigs/current/edu-sig/

-- Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread sturlamolden
On 22 Mar, 23:42, 7stud [EMAIL PROTECTED] wrote:

 Beginning programmers in grades 9-12 are not going to understand
 issues like that, and it would be a mistake to try and introduce
 them.  Beginning programmers should be concentrating their efforts on
 learning the syntax of a language and basic constructs like for-loops
 and if statements.

Yes. And because Python is a scripting language one does not even
have to introduce functions to demonstrate this. Students can play
with loops, datatypes, operators, assignments, and conditionals,
without being confused by higher level constructs like functions and
classes. Python is one of very few languages that allow that. If you
e.g. start to teach programming with with Java, students are from the
start faced with confusing constructs like classes and public static
methods if they are to try out anything on their own. With Python,
higher level constructs can be gradually introduced. That has a
tremendous pedagogical value.






-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Steven D'Aprano
On Sat, 22 Mar 2008 21:11:51 -0700, sturlamolden wrote:

 On 22 Mar, 23:42, 7stud [EMAIL PROTECTED] wrote:
 
 Beginning programmers in grades 9-12 are not going to understand issues
 like that, and it would be a mistake to try and introduce them. 
 Beginning programmers should be concentrating their efforts on learning
 the syntax of a language and basic constructs like for-loops and if
 statements.
 
 Yes. And because Python is a scripting language 


Python is a programming language. It can be used for scripting, but 
that's not all it can do. Describing it as a scripting language is like 
describing a fully-equipped professional kitchen as a left-over warming 
room.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Paul Rubin
jmDesktop [EMAIL PROTECTED] writes:
 For students 9th - 12th grade, with at least Algebra I.  Do you think
 Python is a good first programming language for someone with zero
 programming experience?  Using Linux and Python for first exposure to
 programming languages and principles.

I guess I should ask what is being taught and what the interests of
the students are.  I.e. is it a programming class for students
interested in programming?  If yes, then sure, why not Python.  
If not, then hmmm.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Paul Rubin
Jeff Schwab [EMAIL PROTECTED] writes:
 I've been learning a fair amount about functional programming
 recently, mostly because compile-time C++ turns out to be a pure
 functional programming language.  Where should I go for a solid
 grounding in lambda-calculus?

For PL theory in general, try this:

http://www.cs.cmu.edu/~rwh/plbook/book.pdf
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Mensanator
On Mar 22, 11:29�pm, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
 On Sat, 22 Mar 2008 21:11:51 -0700, sturlamolden wrote:
  On 22 Mar, 23:42, 7stud [EMAIL PROTECTED] wrote:

  Beginning programmers in grades 9-12 are not going to understand issues
  like that, and it would be a mistake to try and introduce them.
  Beginning programmers should be concentrating their efforts on learning
  the syntax of a language and basic constructs like for-loops and if
  statements.

  Yes. And because Python is a scripting language

 Python is a programming language. It can be used for scripting, but
 that's not all it can do. Describing it as a scripting language is like
 describing a fully-equipped professional kitchen as a left-over warming
 room.

Sure, but then again, some are chefs, others merely
cooks and yet others just warm leftovers.


 --
 Steven

-- 
http://mail.python.org/mailman/listinfo/python-list