News for hackers. Stuff that matters.
Re:Swift and the Legacy of Functional Programming by bertiewhykovich on Monday November 21, 2016 @03:01PM (#13008629)
In Python, the only good language, this could be expressed as:

    [person for person in (Person(name) for name in names) if person.isValid()]
or:

    filter(lambda p: p.isValid, map(Person, names))
or:

    persons = []
    for name in names:
        person = Person(name)
        if person.isValid():
            persons.append(person)
Re:Swift and the Legacy of Functional Programming by harpocrates on Monday November 21, 2016 @06:28PM (#13010276)
So much for "There's Only One Way To Do It". :)
Re:Swift and the Legacy of Functional Programming by pjmlp on Tuesday November 22, 2016 @01:22AM (#13012037)
That is long gone, specially regarding string formatting.
Re:Swift and the Legacy of Functional Programming by bertiewhykovich on Tuesday November 22, 2016 @01:32AM (#13012073)
In fairness, the list comprehension would probably be the most "Pythonic" way to do this. The nested iterator might be discouraged (under "explicit is better than implicit," perhaps), so a more Pythonic snippet might look like:

    persons = [Person(name) for name in names]
    valid_persons = [person for person in persons if person.isValid()]
Take this all with a grain of salt, though -- I haven't spent that much time internalizing classical Pythonicness.