[issue29552] Issue in Dictionary fromkeys

2017-02-14 Thread Prudvi Mangadu
Prudvi Mangadu added the comment: Thanks Martin , I will close it. -- stage: -> resolved status: open -> closed ___ Python tracker ___ __

[issue29552] Issue in Dictionary fromkeys

2017-02-14 Thread Martin Panter
Martin Panter added the comment: I suggest to close this as not a bug. -- resolution: -> not a bug ___ Python tracker ___ ___ Python-

[issue29552] Issue in Dictionary fromkeys

2017-02-14 Thread Martin Panter
Martin Panter added the comment: This is similar to the problem of building a list by repeating one item: . With dict.fromkeys(), the resulting dictionary maps each specified key object to the one and onl

[issue29552] Issue in Dictionary fromkeys

2017-02-14 Thread Prudvi Mangadu
Prudvi Mangadu added the comment: Also observed that ID of the values are pointing same, its ok. But if some one later modified that values which causes the un-usual output. >>> id(result['1']) 38121184 >>> id(result['2']) 38121184 -- ___ Python trac

[issue29552] Issue in Dictionary fromkeys

2017-02-14 Thread Prudvi Mangadu
Prudvi Mangadu added the comment: Workaround is replace the below 2 lines with "result ={D_IP:[] for D_IP in input}" == result = {} result = result.fromkeys(input,[]) Issue with this line == -- _

[issue29552] Issue in Dictionary fromkeys

2017-02-14 Thread Prudvi Mangadu
New submission from Prudvi Mangadu: If we load the keys and values using fromkeys on dic. Later the modification in the values is reflects for all keys in the DIC, please follow the below code. ### PS C:\Python2