Question regarding a recent article on informit.com 
Author Message
 Question regarding a recent article on informit.com

An article called "Examining python 2.3: New Additions" on
www.informit.com had the following to say:

"Python now includes iterators, generators, list comprehensions, nested
scopes, type unification-and complete Unicode compatibility. The older
functional programming style constructs, such as map, filter, reduce,
and lambda are deprecated, even if it's unlikely that they will
disappear. "

Is this second sentence true, or is that just an opinion from someone
who favours the imperative style to the functional style? What else
could have been meant by this?

--
Ben Sizer
http://www.*-*-*.com/



Mon, 05 Sep 2005 02:50:08 GMT  
 Question regarding a recent article on informit.com

Quote:

> An article called "Examining Python 2.3: New Additions" on
> www.informit.com had the following to say:

> "Python now includes iterators, generators, list comprehensions, nested
> scopes, type unification-and complete Unicode compatibility. The older
> functional programming style constructs, such as map, filter, reduce,
> and lambda are deprecated, even if it's unlikely that they will
> disappear. "

> Is this second sentence true, or is that just an opinion from someone
> who favours the imperative style to the functional style? What else
> could have been meant by this?

I would think that if code using map, filter, etc. are run through
the 2.3 interpreter and a deprecation warning is not produced, then
by definition (or what *should* be the definition), they are not
officially "deprecated".  I haven't tried that myself, nor do I know
how many would argue with this definition...

-Peter



Mon, 05 Sep 2005 03:15:31 GMT  
 Question regarding a recent article on informit.com

Quote:

> Is this second sentence true, or is that just an opinion from someone
> who favours the imperative style to the functional style? What else
> could have been meant by this?

Well, it was the impression the author gained through reading through
the mailing lists and the newsgroup. I didn't mean that you get deprecation
warnings when you use them.

Anyway, I personally am quite fond of the constructs.

--
Boudewijn Rempt | http://www.valdyas.org



Mon, 05 Sep 2005 03:23:50 GMT  
 Question regarding a recent article on informit.com


Quote:

>> Is this second sentence true, or is that just an opinion from someone
>> who favours the imperative style to the functional style? What else
>> could have been meant by this?

>Well, it was the impression the author gained through reading through
>the mailing lists and the newsgroup. I didn't mean that you get deprecation
>warnings when you use them.

>Anyway, I personally am quite fond of the constructs.

So am I, but that doesn't mean that well meaning haters of those
constructs won't try to slide them away. Apparently we're not only
required to like Python, but also to continually watch that it doesn't
slough its skin off and turn into some other snake entirely.

I wonder if there are examples of languages where features are conserved
ie they start being deprecated and then are miraculously revived and
become approved.
--
Robin Becker



Mon, 05 Sep 2005 03:50:58 GMT  
 Question regarding a recent article on informit.com

Quote:
> An article called "Examining Python 2.3: New Additions" on
> www.informit.com had the following to say:

> "Python now includes iterators, generators, list comprehensions, nested
> scopes, type unification-and complete Unicode compatibility. The older
> functional programming style constructs, such as map, filter, reduce,
> and lambda are deprecated, even if it's unlikely that they will
> disappear. "

> Is this second sentence true, or is that just an opinion from someone

someone == Guido

Quote:
> who favours the imperative style to the functional style? [...]

s/imperative/imperative and OO/

Gerhard
--

web:    http://ghaering.de/



Mon, 05 Sep 2005 02:57:47 GMT  
 Question regarding a recent article on informit.com

Quote:

> An article called "Examining Python 2.3: New Additions" on
> www.informit.com had the following to say:

> "Python now includes iterators, generators, list comprehensions, nested
> scopes, type unification-and complete Unicode compatibility. The older
> functional programming style constructs, such as map, filter, reduce,
> and lambda are deprecated, even if it's unlikely that they will
> disappear. "

> Is this second sentence true, or is that just an opinion from someone
> who favours the imperative style to the functional style? What else
> could have been meant by this?

  Guido has always frowned on the functional elements of Python.  None of
the four is officially deprecated.  There was a discussion on python-dev
(last month, I believe?) about deprecating them.  IIRC, the conclusion
reached was that, at *most*, they might someday be reimplemented in Python,
so as to reduce the amount of C code that makes up the interpreter.  

  Jp

--
"Pascal is Pascal is Pascal is dog meat."
                -- M. Devine and P. Larson, Computer Science 340
--
 up 16 days, 12:00, 1 user, load average: 0.00, 0.00, 0.00



Mon, 05 Sep 2005 03:20:44 GMT  
 Question regarding a recent article on informit.com

|> who favours the imperative style to the functional style? [...]
|s/imperative/imperative and OO/

Nah... that's redundant.  OOP is just one minor variant on imperative
programming.

Yours, Lulu...

--

gnosis  _/_/                    Postmodern Enterprises         _/_/  s r
.cx    _/_/  MAKERS OF CHAOS....                              _/_/   i u
      _/_/_/_/_/ LOOK FOR IT IN A NEIGHBORHOOD NEAR YOU_/_/_/_/_/    g s



Mon, 05 Sep 2005 04:47:37 GMT  
 Question regarding a recent article on informit.com

Quote:

> "Python now includes iterators, generators, list comprehensions, nested
> scopes, type unification-and complete Unicode compatibility. The older
> functional programming style constructs, such as map, filter, reduce,
> and lambda are deprecated, even if it's unlikely that they will
> disappear. "

> Is this second sentence true, or is that just an opinion from someone
> who favours the imperative style to the functional style? What else
> could have been meant by this?

The alternative to map and filter, list comprehension, is not less
functional, it's just a different style (Haskell-style, as opposed to
Lisp-style).  As a side effect you don't need lambda to use list
comprehension.

That lambda is a black sheep of the language has always been true,
evidenced by the syntax restrictions.  Lambda also is not the same as
functional programming, but just a particular (again Lisp) style of
functional programming.  Because of Python's semantics -- and improved
with nested scoping -- anything you can do with a lambda you can do with
a function definition.  You can still *do* all the functional things
without lambda, but sometimes it might be more difficult.

Whether Python is a functional language is more defined by its library
and conventions -- do you modify objects in-place, or return modified
copies?  From that perspective large portions of Python code are not
functional, but that language changes don't effect that one way or the
other.

  Ian



Mon, 05 Sep 2005 06:03:30 GMT  
 Question regarding a recent article on informit.com

Quote:

>   Guido has always frowned on the functional elements of Python.

Why is this? Personally I would have thought that the functional
elements of Python are an important part of what distinguishes it from
being a slightly cleaner version of BASIC? It seems like a lot of sample
code I see here and elsewhere uses map, filter, reduce, and lambda, so
I'd assumed that these features were a significant part of what
attracted people to Python. Maybe I'm wrong? (I'm not exactly an expert
in this language.)

--
Ben Sizer
http://pages.eidosnet.co.uk/kylotan



Mon, 05 Sep 2005 19:09:00 GMT  
 Question regarding a recent article on informit.com

Quote:

>> Is this second sentence true, or is that just an opinion from someone
>> who favours the imperative style to the functional style? What else
>> could have been meant by this?

> Well, it was the impression the author gained through reading through
> the mailing lists and the newsgroup. I didn't mean that you get
> deprecation warnings when you use them.

> Anyway, I personally am quite fond of the constructs.

Thanks for replying! I thought it best to post here than to mail you the
question directly.

I don't know Python well enough to be fond of the constructs, but I've
been meaning to start using Python again recently and was a little
surprised to see that a lot of the functionality that I'd taken to be an
'important' part of the language, from reading this newsgroup in the
past, was being superceded by other features.

Perhaps I just need more up-to-date examples?

--
Ben Sizer
http://pages.eidosnet.co.uk/kylotan



Mon, 05 Sep 2005 19:10:44 GMT  
 Question regarding a recent article on informit.com

Quote:


>>   Guido has always frowned on the functional elements of Python.

> Why is this? Personally I would have thought that the functional
> elements of Python are an important part of what distinguishes it from
> being a slightly cleaner version of BASIC? It seems like a lot of sample
> code I see here and elsewhere uses map, filter, reduce, and lambda, so
> I'd assumed that these features were a significant part of what
> attracted people to Python. Maybe I'm wrong? (I'm not exactly an expert
> in this language.)

What attracts people to Python differs -- but the careful balance
of elegance and pragmaticity, simplicity and power, high level of
abstraction yet ease of access to the lower levels at need, is hardly
affected if one chooses to write, e.g., [x+23 for x in seq if x>0] instead
of map(lambda x: x+23, filter(lambda x: x>0, seq)), is it now?  From
my POV the list comprehension is more elegant, more practical, simpler,
more powerful, AND overall far more Pythonic than the jumble of map,
lambda and filter you'd have to write in its place -- yet I was very
strongly attracted to Python even before list comprehensions were
added to it, so I can't claim this is the key of the attraction!-)

Alex



Mon, 05 Sep 2005 20:23:40 GMT  
 Question regarding a recent article on informit.com


Quote:


>>>   Guido has always frowned on the functional elements of Python.

>> Why is this? Personally I would have thought that the functional
>> elements of Python are an important part of what distinguishes it from
>> being a slightly cleaner version of BASIC? It seems like a lot of sample
>> code I see here and elsewhere uses map, filter, reduce, and lambda, so
>> I'd assumed that these features were a significant part of what
>> attracted people to Python. Maybe I'm wrong? (I'm not exactly an expert
>> in this language.)

>What attracts people to Python differs -- but the careful balance
>of elegance and pragmaticity, simplicity and power, high level of
>abstraction yet ease of access to the lower levels at need, is hardly
>affected if one chooses to write, e.g., [x+23 for x in seq if x>0] instead
>of map(lambda x: x+23, filter(lambda x: x>0, seq)), is it now?  From
>my POV the list comprehension is more elegant, more practical, simpler,
>more powerful, AND overall far more Pythonic than the jumble of map,
>lambda and filter you'd have to write in its place -- yet I was very
>strongly attracted to Python even before list comprehensions were
>added to it, so I can't claim this is the key of the attraction!-)

>Alex

... and, let's repeat, list comprehension isn't anti-functional,
it's just a style of functional expression (or can be seen as
such) which happens to be more Pythonic.
--


Business:  http://www.Phaseit.net
Personal:  http://phaseit.net/claird/home.html



Mon, 05 Sep 2005 20:59:50 GMT  
 Question regarding a recent article on informit.com

Quote:



>> From
>> my POV the list comprehension is more elegant, more practical,
>> simpler, more powerful, AND overall far more Pythonic than the
>> jumble of map, lambda and filter you'd have to write in its place --
>> yet I was very strongly attracted to Python even before list
>> comprehensions were
>> added to it, so I can't claim this is the key of the attraction!-)

> ... and, let's repeat, list comprehension isn't anti-functional,
> it's just a style of functional expression (or can be seen as
> such) which happens to be more Pythonic.

Ok, fair points; I probably just misunderstood what Boudewijn had meant
in the first place - the 'functional programming style constructs' may
be discouraged but the functional style will still be possible. Right?

Are there any good tutorials of examples of list comprehension use? In
particular, I'm interested in how to replicate the functionality of
reduce? Map and filter seem easy to do, though.

--
Ben Sizer
http://pages.eidosnet.co.uk/kylotan



Mon, 05 Sep 2005 21:33:22 GMT  
 Question regarding a recent article on informit.com

Quote:

> Are there any good tutorials of examples of list comprehension use? In
> particular, I'm interested in how to replicate the functionality of
> reduce? Map and filter seem easy to do, though.

Doesn't reduce return a non-list (or at least, isn't it the case that
it doesn't necessarily return a list the way map and filter do)?

An *abuse* of a list comprehension, or a list comprehension in
conjuction with something else, could probably replicate reduce(),
but why bother?  reduce() isn't really like map and filter.

-Peter



Mon, 05 Sep 2005 21:34:48 GMT  
 
 [ 25 post ]  Go to page: [1] [2]

 Relevant Pages 

1. InformIT article

2. ANN: Two Python articles on InformIT

3. PyCom Question and regarding ActiveX and COM Objects

4. Recent emails from A. Robbins, regarding latest GAWK (3.0.95)

5. Recent articles on Python

6. Recent article on design verification

7. Recent article on design verification

8. Recent article on design verification

9. Recent article in UniNews

10. Recent CACM "viewpoint" article

11. recent article on Fortran and C

12. Yourdan's recent article on SM

 

 
Powered by phpBB® Forum Software