General question about Python design goals
mwm at mired.org
Sat Dec 3 02:15:10 CET 2005
Donn Cave <donn at u.washington.edu> writes:
> In article <86k6epl12q.fsf at bhuda.mired.org>, Mike Meyer <mwm at mired.org>
>> Seriously. Why doesn't this have to be phrased as "for x in list((1,
>> 2, 3))", just like you have to write list((1, 2, 3)).count(1), etc.?
> How could list(t) work, if for x in t didn't?
> For me, conceptually, if an object can't be accessed
> sequentially, then it can't be mapped to a sequence.
So you're saying that for should implicitly invoke list (or maybe
iter) on any object that it's passed that's not a list or iterator?
> Anyway, it seems to me that in the end this is about
> that balance between practicality and purity. Maybe
> it's more like tuples have a primary intended purpose,
> and some support for other applications. Not white,
> but not pure black either.
If you do that, you've just weakened the case for not having count
etc. as methods of tuples.
It really is the dichotomy of "tuples aren't meant to be sequences so
they don't have ..." versus being able to access them sequentially
that gets me. That just doesn't seem right.
Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
More information about the Python-list