On 6/15/2013 5:45 PM, Tres Seaver wrote:
Given that strings are implemented in C,
That is a current implementation detail. String functions were
originally written in python in string.py. Some used 'for c in s:'. The
functions only because methods after 2.2. I presume Pypy starts from
Python code again.
> there is no real "iteration"
happing (in the Python sense) in their methods.
I disagree, but not relevant.
What stdlib code can you
point to that does iterate over them in Python? I.e.:
for c in stringval:
Using Idle's grep (Find in files) for ...Python33/Lib/*.py:
'for c in' 193 hits
'for ch in' 30 hits
'for chr in' 0 hits
'for char in' 14 hits.
Some, especially in the 193, are false positives, but most are not.
There are at least a few other 'for name in string' uses: for instance,
'for a in _hexdig for b in _hexdig' where _hexdig is
'0123456789ABCDEFabcdef'.
--
Terry Jan Reedy
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com