[SciPy-user] Behavior of string.join differs from standard python
Travis Oliphant
oliphant.travis at ieee.org
Tue Jan 24 13:06:20 EST 2006
Yann Le Du wrote:
>Hello,
>
>Just a small problem I stumbled upon.
>
>I'd like to know why the behavior of string.join in scipy is different
>from that of standard python ?
>
>In scipy :
>
># string.join("",["a","b","c"])
>
>
Look at
type(numpy.string)
and
type(string)
for part of the answer.
>And also, the documentation of string.join is not clear, because if you do
>what's written there, there's an error.
>
>
The doc-string (please call it that not "the documentation" which
usually refers to off-line docs), is exactly the same as str.join
because the string object in numpy inherits from the str object in Python.
So, numpy.string.join is an unbound method. Thus, the first argument
must be a "joining" string. However, the string module has a different
calling syntax.
My understanding is that the string module is deprecated, by the way
since most of the functionality are now methods on strings.
-Travis
More information about the SciPy-User
mailing list