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 8380967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:35:36+00:00 2026-06-09T16:35:36+00:00

I know it has a good reason, but I want to know what reason?

  • 0

I know it has a good reason, but I want to know what reason?

>>> print all([])
True

If all() is intended to check if every item on iterable evaluates to “True”, and we know empty lists are evaluated to False

>>> bool([])
False

So why the all() returns True for empty lists?

< edit >

I already read the docs, and I know the implementation

 def all(iterable):
    for element in iterable:
        if not element:
            return False
    return True

But the question is why not?

def all(iterable):
    if not iterable:
        return False
    for element in iterable:
        if not element:
            return False
    return True

There is a logic on this? if you have a list of done-tasks

today_todo_status = [task.status for task in my_todo if task.date == today]
can_i_go_home = all(today_todo_status)

Ok, on the above hypothetical example it really makes sense, if I have no tasks, so I can go home.

But there are other cases and I dont think all() was made for todo lists.. LOL

< /edit >

  • 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. Editorial Team
    Editorial Team
    2026-06-09T16:35:38+00:00Added an answer on June 9, 2026 at 4:35 pm

    This is expressed as "For all X in S, X is true". If S is empty, there are no X. However, the truth statement remains True, because for all X, X was true… there just aren’t any X!

    Here is a explanation using logic.

    Consider two sets A and B where A+B is the union of the two sets.

    If any(A+B) = True -> any(A) or any(B) = True but we cannot assert
    either any(A)=True or any(B)=True.

    If any(A+B) = False -> any(A) = False and any(B) = False.

    If all(A+B) = True -> all(A)=True and all(B)=True

    if all(A+B) = False -> all(A)=False or all(B)=False but we cannot assert either all(A)=False or all(B)=False.

    Now instead of B, let’s add the empty set Ø to A. We want to come up
    logic such that adding the empty set does not change the values of
    all() or any(), since A+Ø=A.

    any(A+Ø) = any(A) or any(Ø)

    any(Ø) must be False, so that if any(A) is True, any(A+Ø) is True, and
    if any(A) is False, any(A+Ø) is False.

    all(A+Ø) = all(A) and all(Ø)

    if all(A) is True, all(A+Ø) is True. Therefore, all(Ø) is True.

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

Sidebar

Related Questions

I know that CakePHP has very good validation out of the box, but I
I know this has probably been asked before but for my problem I cannot
I know this has been asked at least a thousand times but I can't
i know this has already been asked here in stackoverflow, but i could not
I know C# has both value and reference types, but how can you do
I know this has been asked all over the web in various different scenarios,
I know this has been asked different ways several times, but I'm just not
I have a tree-like model where in all situations but one , I want
I know VS2012 has the ability to start the Windows Simulator right out of
I know this has been asked before ( Get Absolute Position of element within

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.