On Tue, Oct 25, 2011 at 12:56:56AM +0100, Alan Gauld wrote:
> On 24/10/11 20:52, Johan Martinez wrote:
> >Finally I figured it out ( __length__() ) thanks to ipython shell env.
>
> len(x)
>
> gets converted to x.__length__() by Python.
That's actually __len__ not __length__.
>>> [].__length__
On 24/10/11 20:52, Johan Martinez wrote:
Also, is there any doc link where I can find all the information about
String object - class and instance methods.
>>> help(str)
or even
>>> help("")
For a quick list try dir()
>>> dir ("")
Finally I figured it out ( __length__() ) thanks to ipy
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 wrote:
>
>
> On Mon, Oct 24, 2011 at 2:32 PM, Steve Willoughby wrote:
>
>> On 24-Oct-11 12:17, Johan Martinez wrote:
>>
>>> Thanks for the replies everyone - St
On Mon, Oct 24, 2011 at 2:32 PM, Steve Willoughby 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 t
On 10/24/2011 03:21 PM, Johan Martinez wrote:
On Mon, Oct 24, 2011 at 2:07 PM, Andreas Perstinger<
andreas.perstin...@gmx.net> wrote:
On 2011-10-24 20:04, Johan Martinez wrote:
Hi,
I am struggling to understand Python string immutability. I am able to
modify Python string object after initi
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 :) Unf
What you did here is just re-assigning s.
Try slicing s and then assign a new value to the slice.
s[2] would return 'r' now try to to set s[2] to another value to understand
immutability.
Hope it helps.
On 24 Oct 2011 19:06, "Johan Martinez" wrote:
> Hi,
>
> I am struggling to understand Python
On Mon, Oct 24, 2011 at 2:07 PM, Andreas Perstinger <
andreas.perstin...@gmx.net> wrote:
> On 2011-10-24 20:04, Johan Martinez wrote:
>
>> Hi,
>>
>> I am struggling to understand Python string immutability. I am able to
>> modify Python string object after initializing/assigning it a value.
>>
>>
On Mon, Oct 24, 2011 at 1:52 PM, Wayne Werner wrote:
> On Mon, Oct 24, 2011 at 1:04 PM, Johan Martinez wrote:
>
>> Hi,
>>
>> I am struggling to understand Python string immutability. I am able to
>> modify Python string object after initializing/assigning it a value. So how
>> does immutability wo
On 2011-10-24 20:04, Johan Martinez wrote:
Hi,
I am struggling to understand Python string immutability. I am able to
modify Python string object after initializing/assigning it a value.
s = "First"
print s.__class__
print s
First
s = "Second"
print s
Second
Dave, Sander and Wayne
On Mon, Oct 24, 2011 at 01:04:20PM -0500, Johan Martinez wrote:
> Hi,
>
> I am struggling to understand Python string immutability. I am able to
> modify Python string object after initializing/assigning it a value. So how
> does immutability work? I am not following it. Sorry for really stupid
>
On Mon, Oct 24, 2011 at 1:04 PM, Johan Martinez wrote:
> Hi,
>
> I am struggling to understand Python string immutability. I am able to
> modify Python string object after initializing/assigning it a value. So how
> does immutability work? I am not following it. Sorry for really stupid
> question
On Mon, 24 Oct 2011, 20:04:20 CEST, Johan Martinez wrote:
> I am struggling to understand Python string immutability. I am able to
> modify Python string object after initializing/assigning it a value. So
> how does immutability work? I am not following it. Sorry for really
> stupid question. Any
On 10/24/2011 02:04 PM, Johan Martinez wrote:
Hi,
I am struggling to understand Python string immutability. I am able to
modify Python string object after initializing/assigning it a value. So how
does immutability work? I am not following it. Sorry for really stupid
question. Any help?
You're c
14 matches
Mail list logo