[Tutor] something is fundamentally wrong...
Ricardo Aráoz
ricaraoz at gmail.com
Mon Aug 11 16:16:02 CEST 2008
Joshua Nikkel wrote:
>
> ah that was it. I had a variable named len earlier. On a restart it
> was fine. Thanks!
>
Besides that you have a HUGE error!!!
Your spelling! It should be :
>>> s = 'supercalifragilisticoexpialidoso'
:P
>
> On Sun, Aug 10, 2008 at 2:04 PM, Robert Berman <bermanrl at embarqmail.com
> <mailto:bermanrl at embarqmail.com>> wrote:
>
> No. Not so.
>
> Observe, please:
> Python 2.5.2 (r252:60911, May 7 2008, 15:19:09)
> [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
>
> Type "copyright", "credits" or "license()" for more information.
>
> ****************************************************************
> Personal firewall software may warn about the connection IDLE
> makes to its subprocess using this computer's internal loopback
> interface. This connection is not visible on any external
> interface and no data is sent to or received from the Internet.
> ****************************************************************
>
> IDLE 1.2.2 ==== No Subprocess ====
> >>> import math
> >>> math.sqrt(1054.12)
> 32.467214232206615
> >>> s = 'supercalifragilisticexpialidocious'
> >>> s
> 'supercalifragilisticexpialidocious'
> >>> len(s)
> 34
> >>>
>
> Have you by any chance assigned the function len to something else?
> Otherwise, it should work really well. If you do help(len) in the
> shell, wha dos it tell you.
>
> Robert
>
> Joshua Nikkel wrote:
>> I've pasted the following from my python shell. Please note that
>> the first two lines of code are taken directly from the standard
>> tutorial files under section 3.1.2. <http://3.1.2.> Will someone
>> please tell me why something as basic and straightforward as this
>> will not work? Everything else seems to work just fine, but not
>> this. All I need is someway to get the length of a string...
>>
>> please help,
>>
>> nosh
>>
>>
>> Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32
>> bit (Intel)] on win32
>> Type "copyright", "credits" or "license()" for more information.
>>
>> ****************************************************************
>> Personal firewall software may warn about the connection IDLE
>> makes to its subprocess using this computer's internal loopback
>> interface. This connection is not visible on any external
>> interface and no data is sent to or received from the Internet.
>> ****************************************************************
>>
>> IDLE 1.2.2 ==== No Subprocess ====
>> >>> s = 'supercalifragilisticexpialidocious'
>> >>> len(s)
>> Traceback (most recent call last):
>> File "<pyshell#1>", line 1, in <module>
>> len(s)
>> TypeError: 'str' object is not callable
>> >>> s
>> 'supercalifragilisticexpialidocious'
>> >>> len(s)
>> Traceback (most recent call last):
>> File "<pyshell#3>", line 1, in <module>
>> len(s)
>> TypeError: 'str' object is not callable
>> >>>
More information about the Tutor
mailing list