Raymond Hettinger wrote: >>If you ever wanted to have the power of list comprehensions but > > without > >>the overhead of generating the entire list you have Peter Norvig >>initially and then what seems like the rest of the world for generator >>expressions. > > > [possibly mangled sentence doesn't make sense] > Or me not typing as fast as my brain is working. There is a critical "to thank" missing from that sentence. > > > >>After the addition of the 'key' argument to list.sort(), people began > > to > >>clamor for list.sort() to return self. Guido refused to do give in, > > so > >>a compromise was reached. 'list' now has a class method named > > 'sorted'. > >> Pass it a list and it will return a *copy* of that list sorted. > > > > [Add] > What makes a class method so attractive is that the argument need not be > a list, any iterable will do. The return value *is* of course a list. > > By returning a list instead of None, list.sorted() can be used as an > expression instead of a statement. This makes it possible to use it as > an argument in a function call or as the iterable in a for-loop:: > > # iterate over a dictionary sorted by key > for key, value in list.sorted(mydict.iteritems()): > Changed it to state that it takes an iterable. Didn't add the full-on tutorial on use, though. Chances are people who read the Summary know Python well enough to realize the method's use. > > > >>As an interim solution, itertools grew a new function: tee. It takes > > in > >>an iterable and returns two iterators which independently iterate over >>the iterable. > > > [replace] two > [with] two or more > > Done. > > >>The point that operator.isMappingType is kind of broken came up. Both >>Alex and Raymond Hettinger would not mind seeing it disappear. No one >>objected. It is still in CVS at the moment, but I would not count on > > it > >>necessarily sticking around. > > > ["It's not quite dead yet" ;-) Actually, there may be a way to > partially fix-it so that it won't be totally useless]. > > Fixed. > > >>There was a new built-in named reversed(), and all rejoiced. > > > [And much flogging of the person who proposed it] > > Fixed. =) > > >>Straight from the function's doc string: "reverse iterator over values >>of the sequence". `PEP 322`_ has the relevant details on this toy. > > > [Replace] toy > [With] major technological innovation of the first order > [Or just] builtin. > > I went with the latter since I need to keep some journalistic integrity and thus not be too biased. =) > > > >>Sets now at blazing C speeds! > > > [Looks like a certain parroteer will soon by eating pie!] > > > > Another fine summary. > Thanks for the good work. > You're quite welcome. Happy Thanksgiving, Raymond (and everyone else out there). -Brett
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4