[Tutor] string immutability
Joel Goldstick
joel.goldstick at gmail.com
Mon Oct 24 23:48:44 CEST 2011
the len() function works on lots of objects:
>>> a = "this is a string"
>>> len(a)
16
On Mon, Oct 24, 2011 at 3:52 PM, Johan Martinez <jmartiee at gmail.com> wrote:
>
>
> On Mon, Oct 24, 2011 at 2:32 PM, Steve Willoughby <steve at alchemy.com>wrote:
>
>> On 24-Oct-11 12:17, Johan Martinez wrote:
>>
>>> Thanks for the replies everyone - Steve, Dave, Sander and Wayne. I
>>> realized my wrong understanding/interpretation after posting the message
>>> to the list, which usually happens most of the time with me!
>>>
>>
>> That happens to most of us all the time too :) Unfortunately, with the
>> lag between posting to the list and mail getting out to everyone, you'll
>> probably get several replies that all say the same thing--we're not piling
>> up on you, it's just a bunch of people being helpful without seeing that
>> someone already answered yet.
>>
>> Glad we could help. Looking more into how Python variables work unlocks a
>> lot of potential for all sorts of data structure operations that other
>> languages require pointers to do, but are a lot easier when essentially all
>> "variables" are references to objects but with the details handled behind
>> the scenes for you.
>>
>> --
>> Steve Willoughby / steve at alchemy.com
>> "A ship in harbor is safe, but that is not what ships are built for."
>> PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C
>
>
> Actually it's good to see so many replies and different methods and
> explanations here.
>
> Also, is there any doc link where I can find all the information about
> String object - class and instance methods. Google pointed me to following
> two links, but that wasn't helpful for finding instance method for finding
> length of a string object (rather than using 'len' function).
>
> - http://docs.python.org/library/string.html
> - http://docs.python.org/library/stdtypes.html#string-methods
>
> Finally I figured it out ( __length__() ) thanks to ipython shell env. But
> is there any online documentation or interactive reference like ruby-ri?
>
> jM.
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
--
Joel Goldstick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111024/4cf87eb0/attachment-0001.html>
More information about the Tutor
mailing list