Active Entries
- 1: Surge Pricing for Grocery Stores is a Disaster Only Psychopath MBAs Could Love
- 2: Antarctica Day 7: Swimming In the Antaractic Seas
- 3: Restarted my yoga classes, and I discovered I'm a total wreck
- 4: Antarctica: Getting To the Boat and the Disaster That Awaited
- 5: The Enshittification of All That Lives
- 6: How the green energy discourse resembles queer theory
- 7: Tori's Sake & Grill (restaurant, review)
- 8: I'm Not Always Sure I Trust My ADHD Diagonosis
- 9: You can't call it "Moral Injury" when your "morals" are monstrous
- 10: Ebay vs Newmark: You're all just cogs. Accept it. There is no joy in it, but you have no choice.
Style Credit
- Base style: ColorSide by
- Theme: NNWM 2010 Fresh by
Expand Cut Tags
No cut tags
no subject
Date: 2003-07-22 04:23 pm (UTC)snmpUserNames = map( lambda a: a.getName(), filter( lambda a: a.getType() == 'SNMP', lUSers) )
The map and filter keywords are functional: they allow one to perform either named or anonymous functions (lambda allows the generation of anonymous functions with very locally scoped variables-- no contamination of the surrounding variable namespace occurs) on a collection (lUsers) of objects. This is a very trivial example, but it shows one of the steps in going from raw data to highly refined and precise output: for every user in lUsers, generate a list that has SNMP access, and then from that list generate a list of usernames. Using traditional 'for' loops and 'if' statments, this could get long, ugly, and error-prone.
Python is simply easier to learn than Perl, and by definition that makes it easier to write. A Perl programmer, a good one, can write miraculous filters in seconds-- but large programs in Perl are impossible to read.