GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow `False` to be passed to `filter` · Issue #70027 · python/cpython

Allow False to be passed to filter #70027

New issue
Copy link
New issue
Copy link
Closed
Closed
Allow False to be passed to filter#70027
Copy link
Labels
type-featureA feature request or enhancementA feature request or enhancement

Description

leewz
mannequin
opened on Dec 11, 2015
Issue body actions
BPO 25840
Nosy @bitdancer, @leewz, @Vgr255

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2015-12-11.15:45:34.289>
created_at = <Date 2015-12-11.15:02:00.929>
labels = ['type-feature']
title = 'Allow `False` to be passed to `filter`'
updated_at = <Date 2015-12-11.19:54:59.059>
user = 'https://github.com/leewz'

bugs.python.org fields:

activity = <Date 2015-12-11.19:54:59.059>
actor = 'leewz'
assignee = 'none'
closed = True
closed_date = <Date 2015-12-11.15:45:34.289>
closer = 'r.david.murray'
components = []
creation = <Date 2015-12-11.15:02:00.929>
creator = 'leewz'
dependencies = []
files = []
hgrepos = []
issue_num = 25840
keywords = []
message_count = 4.0
messages = ['256218', '256219', '256222', '256231']
nosy_count = 3.0
nosy_names = ['r.david.murray', 'leewz', 'abarry']
pr_nums = []
priority = 'normal'
resolution = 'rejected'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue25840'
versions = ['Python 3.6']

Activity

  1. leewz commented on Dec 11, 2015

    @leewz
    leewzmannequin
    on Dec 11, 2015
    MannequinAuthor
    More actions

    Meaning:

        filter(False, lst)
        == (x for x in lst if not x)
        == itertools.filterfalse(None, lst)

    I understand that it is a very minor enhancement, and with not much benefit. I just happened to think about it, and wondered why it didn't already exist. I figured it wouldn't hurt to put the idea out here.

    (If anyone is interested, I was looking into ways that filter/map/itertools could "unwrap" each other at the C level to improve composition of generators, inspired by the functools.partial optimization.)

  2. leewz
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Dec 11, 2015
  3. Vgr255 commented on Dec 11, 2015

    @Vgr255
    Vgr255mannequin
    on Dec 11, 2015
    Mannequin
    More actions

    Do you mean like 'filter(None, lst)' does?

  4. bitdancer commented on Dec 11, 2015

    @bitdancer
    bitdancer
    on Dec 11, 2015
    Member
    More actions

    I don't think it is worth adding as a special case. Itertools has it because of what itertools is (a mini-language for manipulating iterables), but the legacy filter function has no reason to grow additional special cases beyond None. (It's not even clear why it has that one special case :)

  5. bitdancer
    closed this as completedon Dec 11, 2015
  6. leewz commented on Dec 11, 2015

    @leewz
    leewzmannequin
    on Dec 11, 2015
    MannequinAuthor
    More actions

    ebarry, note that filter(None, lst) is equivalent to filter(bool, lst), which is the opposite of filterfalse(None, lst). (Though filter(True, lst) == filter(bool, lst) would be a parallel.)

  7. ezio-melotti
    transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.