Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 55343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:21:45+00:00 2026-05-10T17:21:45+00:00

There seems to be a lot of heated discussion on the net about the

  • 0

There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficulty understanding why this is the case; I find it quite reasonable to use it in a variety of cases. If the contempt was simply subjective, I cannot imagine that such a large number of people would care about it.

What am I missing? What is the problem with reduce()?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:21:46+00:00Added an answer on May 10, 2026 at 5:21 pm

    As Guido says in his The fate of reduce() in Python 3000 post:

    So now reduce(). This is actually the one I’ve always hated most, because, apart from a few examples involving + or *, almost every time I see a reduce() call with a non-trivial function argument, I need to grab pen and paper to diagram what’s actually being fed into that function before I understand what the reduce() is supposed to do. So in my mind, the applicability of reduce() is pretty much limited to associative operators, and in all other cases it’s better to write out the accumulation loop explicitly.

    There is an excellent example of a confusing reduce in the Functional Programming HOWTO article:

    Quick, what’s the following code doing?

    total = reduce(lambda a, b: (0, a[1] + b[1]), items)[1] 

    You can figure it out, but it takes time to disentangle the expression to figure out what’s going on. Using a short nested def statements makes things a little bit better:

    def combine (a, b):     return 0, a[1] + b[1]  total = reduce(combine, items)[1] 

    But it would be best of all if I had simply used a for loop:

    total = 0 for a, b in items:     total += b 

    Or the sum() built-in and a generator expression:

    total = sum(b for a,b in items) 

    Many uses of reduce() are clearer when written as for loops.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 62k
  • Answers 62k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer To hide the GridView columns, you can use the GridView_RowDataBoundEvent… May 11, 2026 at 10:17 am
  • added an answer You need to mark this file with the DeploymentItemAttribute if… May 11, 2026 at 10:17 am
  • added an answer To achieve that you need to change the Control template… May 11, 2026 at 10:17 am

Related Questions

There seems to be a lot of heated discussion on the net about the
I've had some experience with Pygame, but there seems to be a lot of
I've created a custom thread pool utility, but there seems to be a problem
I've noticed that there seems to be quite a bit of hostility towards Linq
There seems to be no good way to localize a WPF application. MSDN seems
So there seems to be this problem with GNU Make's $(wildcard) function keeping a
There seem to be a number of weird things one could do if one
There doesn't seem to be a dictionary.AddRange() method. Does anyone know a better way
There seem to be many ways to define singletons in Python. Is there a
What references offer a good summary/tutorial for using RDF/OWL? There seem to be enough

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.