3 ms·
So much for "There's Only One Way To Do It". :)
by harpocrates 10y ago
So much for "There's Only One Way To Do It". :)
- pjmlp 10y agoThat is long gone, specially regarding string formatting.
- bertiewhykovich 10y agoIn 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.