Python complaints
Gordon McMillan
gmcm at hypernet.com
Wed Dec 15 09:15:17 EST 1999
Charles Boncelet wrote:
[snip]
> I think all functions that operate on single things should be
> able to operate on a list of things and return a list of things.
> (Are there obvious reasons why this paradigm can't work?)
Yes.
> Consider,
>
> >>> l = [1,2,3]
> >>> m = [l,l]
> >>> len(l)
> 2
> >>> len(m)
> 3
>
> I want len(m) to return [3,3]. And I want: max(len(m)) to return
> 3, etc.
>
> (Yes, I know I can write my version of
> len and have it return whatever I want it to, but I am wondering
> about the paradigm and why it is not generally true.)
l = [[1,2], [[1,2,3],2], 1, "eggs"]
What should len(l) produce?
What would we do with all those
for i in range(len(...)): ?
- Gordon
More information about the Python-list
mailing list