[Python-checkins] CVS: python/dist/src/Lib string.py,1.46,1.47
Adrian Eyre
a.eyre at optichrome.com
Mon Feb 14 12:37:52 EST 2000
> there is no such thing as a PySequenceObject.
Erk. You're right. I just figured Python's internal object structure
had a vague hierarchy like this:
Object
+- Sequence
| +- List
| +- Tuple
| +- String
+- Mapping
| +- Dictionary
+- Number
+- Integer
+- Long integer
But actually it's far more bizarre.
>> Besides, I don't see the connection...
> you will. you will.
Care to elaborate? :)
I was refering to the connection with my original post about the join()
method being added to the string object, when it more logically goes
on a list/sequence...
e.g.
>>> s = "this is a test"
>>> s.split()
['this', 'is', 'a', 'test']
...seems reasonable, but...
>>> l = s.split()
>>> " ".join(l)
'this is a test'
...doesn't. If it were on a list, you could do things like this:
>>> s = "a:b:c"
>>> s.split(":").join(", ")
'a, b, c'
-----------------------------------------------------------------
Adrian Eyre <a.eyre at optichrome.com> - http://www.optichrome.com
More information about the Python-list
mailing list