sets.filter?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gerrit Holl

    sets.filter?

    Hi,

    would it be a good idea to add a .filter() method to a set object,
    which behaves like the builtin filter() but resulting in a set?
    I often see myself doing sets.Set(filter (f, someset))... Would this
    be a good addition to sets.Set?

    yours,
    Gerrit.

    --
    2. If any one bring an accusation against a man, and the accused go to
    the river and leap into the river, if he sink in the river his accuser
    shall take possession of his house. But if the river prove that the
    accused is not guilty, and he escape unhurt, then he who had brought the
    accusation shall be put to death, while he who leaped into the river shall
    take possession of the house that had belonged to his accuser.
    -- 1780 BC, Hammurabi, Code of Law
    --
    Asperger Syndroom - een persoonlijke benadering:

    Het zijn tijden om je zelf met politiek te bemoeien:
    De SP kiest voor menselijke waardigheid, gelijkwaardigheid en solidariteit. Sluit je aan bij de sociaalste en actiefste partij van Nederland!


  • Jeremy Fincher

    #2
    Re: sets.filter?

    Gerrit Holl <gerrit@nl.linu x.org> wrote in message news:<mailman.1 056577245.15021 .python-list@python.org >...[color=blue]
    > would it be a good idea to add a .filter() method to a set object,
    > which behaves like the builtin filter() but resulting in a set?
    > I often see myself doing sets.Set(filter (f, someset))... Would this
    > be a good addition to sets.Set?[/color]

    Yes, it'd be a great idea. filter/map/reduce should've been methods
    on sequences from the beginning.

    Jeremy

    Comment

    Working...