modules and namespaces

Berthold Höllmann hoel at gl-group.com
Tue Apr 19 10:53:58 EDT 2005


Laszlo Zsolt Nagy <gandalf at geochemsource.com> writes:

>>However it doesn't work until I import the string module into m1 and m2
>>modules. I found in the manual that imported modules will be searched in
>>the container module first. Is it more efficient to import the string
>>module into main and m1 and m2 than importing only into m1 and m2?
>>
>>
> I bet the most efficient is

But is is not working.

> str.join( ('a','b'))

Python 2.4.1 (#1, Mar 31 2005, 09:19:04) 
[GCC 3.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> str.join(('a','b'))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: descriptor 'join' requires a 'str' object but received a 'tuple'
>>> str.join('a','bcdefg')
'bacadaeafag'
>>> str().join(('a','b'))
'ab'

Kind regards
Berthold
-- 
hoel at GL-Group.com              __   Address:
                            G /  \ L Germanischer Lloyd
phone: +49-40-36149-7374    -+----+- Vorsetzen 35       P.O.Box 111606
fax  : +49-40-36149-7320      \__/   D-20459 Hamburg    D-20416 Hamburg



More information about the Python-list mailing list