Re: [SLUG] Semi-experienced Python Programmers?

From: Paul M Foster (paulf@quillandmouse.com)
Date: Thu Jan 31 2008 - 11:06:45 EST


On Thu, Jan 31, 2008 at 10:26:35AM -0500, Dylan William Hardison wrote:

<snip>

>
> So you prefer:
>
> xs = []
> for x in range(10): xs.append(x * 20)
>

This is okay.

> to this?
>
> xs = [x * 20 for x in range(10) ]
>

Not so much.

> or this?
>
> xs = map(lambda x: x * 20, range(10))
>

Ewww.

>
> I prefer the list comprehension syntax, especially when manipulating large or
> complicated sets of data.
>

I recall reading that APL, which I've studied, is a functional language.
But like other functional languages, it requires a different way of
thinking. But then, that makes sense since APL is best a dealing with
matrices and the like. Most of what I do is database programming, and I
suspect most coders don't deal with "large or complicated sets of data".

<snip>

> Object orientation is actually bolted on to C++ and Java, and less so on
> Python... At least everything in python is/behaves like an object.

I don't know about Java, but I'll heartily agree that C++ is a total OO
hack on top of C. I'm not sure why Smalltalk didn't follow through to
become the leading OO language. My guess is that it's programmer inertia.
C++ and Java are popular, I think, because you can take your C skills and
use them there. Similar with PHP, which is fast growing in adoption.

>
> Well, almost everything. You cannot use computation as a value in python,
> short
> of using a thunk, which isn't the same.
>

Yeah, I've noticed that Python isn't as OO as Pythoners like to think.

Paul

-- 
Paul M. Foster
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:30:00 EDT