Python rocks
Aahz
aahz at pythoncraft.com
Sat Jun 2 16:58:39 EDT 2007
In article <1180807432.351720.123860 at p47g2000hsd.googlegroups.com>,
George Sakkis <george.sakkis at gmail.com> wrote:
>
>I had probably stumbled on many/most of the common pitfalls usually
>mentioned (e.g. http://www.ferg.org/projects/python_gotchas.html,
>http://zephyrfalcon.org/labs/python_pitfalls.html) while learning, but
>picked them up easily after the first or second time. Off the top of
>my head, two errors that keep coming back even years after are:
>- Comparing instances of (semantically) incomparable types (http://
>www.ibm.com/developerworks/library/l-python-elegance-1.html).
>Thankfully this will be fixed in Py3k.
>- Strings being iterable; unfortunately this will stay in Py3K.
I'll repeat the comment I made on python-3000:
"...string iteration isn't about treating strings as sequences of
strings, it's about treating strings as sequences of characters. The
fact that characters are also strings is the reason we have problems,
but characters are strings for other good reasons."
Thing is, the fact that you can e.g. slice strings just like other
sequence types creates the consequence that you can also iterate over
strings -- moreover, some of us actually do iterate over strings (though
of course we could if necessary create lists/tuples of characters). In
the grand scheme of things, I rarely see people running into problems
with iterating over strings.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"as long as we like the same operating system, things are cool." --piranha
More information about the Python-list
mailing list