[docs] Code not working

bob gailer bgailer at gmail.com
Fri Jan 19 20:25:14 EST 2018


On 1/12/2018 4:32 PM, Berker Peksağ wrote:
> On Fri, Jan 12, 2018 at 5:21 PM, Pushergene via docs <docs at python.org> wrote:
>> Hey,
>> The code in
>> https://docs.python.org/3/library/operator.html#inplace-operators is not
>> working.
>> Its confusing, please change it... python 3.6.4
> Can you give us a little bit more details? Both snippet work for me:
The snippet does not include

from operator import iadd

Berker realizes that and "automatically" adds it.
Pushergene tries the snippet as given and wonders why it does not work.
It would seem to me trivial to add the import to the snippet.
>>>> from operator import iadd
>>>> a = 'hello'
>>>> iadd(a, ' world')
> 'hello world'
>>>> s = ['h', 'e', 'l', 'l', 'o']
>>>> iadd(s, [' ', 'w', 'o', 'r', 'l', 'd'])
> ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
>>>> s
> ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
>
> --Berker
> _______________________________________________
> docs mailing list
> docs at python.org
> https://mail.python.org/mailman/listinfo/docs
>

-- 
Image and video hosting by TinyPic


More information about the docs mailing list