Paul Prescod wrote: > > "M.-A. Lemburg" wrote: > > > > ... > > > > Just for completeness: mx.Tools already has these APIs: > > > > tuples(sequence) > > Returns much the same as apply(map,(None,)+tuple(sequence)) does, > > Like it. > > > lists(sequence) > > Same as tuples(sequence), except that a tuple of lists is returned. > > Like it. > > > dict(items) > > Constructs a dictionary from the given items sequence. > > Like it. > > In my opinion, these are naturals for built-in functions. Cool! > > These I'm not as sure about: > > > irange(object[,indices]) > > Builds a tuple of tuples (index,object[index]). > > Isn't this just tuples( indices( object ), object ) Yep, but less to write... > > indices(object) > > Returns the same as tuple(range(len(object))) -- > > Could be obsoleted by the range-building syntax: > > [0..len(object)] > > would do the same thing. True, except that I find indices(obj) more intuitive (and its just one function call). Technical note: tuples build faster than lists. -- Marc-Andre Lemburg ______________________________________________________________________ Business: http://www.lemburg.com/ Python Pages: http://www.lemburg.com/python/
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