adambard / learnxinyminutes-docs

Code documentation written as code! How novel and totally my idea!
https://learnxinyminutes.com/
Other
11.44k stars 3.32k forks source link

Python/deep & shallow copy error #4860

Open AnkurKumarShukla opened 6 months ago

AnkurKumarShukla commented 6 months ago

Is this a major issue that you cannot fix?

I can fix it. Being a community driven documents of languages and tools,"YOUR" contributions are also important. If the issue you're reporting is trivial to report to maintainers why not contribute to fix it. In that way, you will have contributed to an awesome open-source project. The changes can be typo fix, fixing of data in examples or grammar fix. If you found it, why not do it and take full credit for it?

Make sure the issue title is prepended with '[language/lang-code]' if the language is already on the site. If it's a request for a new language, use: '[Request] [language/lang-code]'

Issues are always welcome. If you are able and willing, we welcome any pull requests as this is a community powered project.

Issue line : # Make a one layer deep copy using slices li2 = li[:] # => li2 = [1, 2, 4, 3] but (li2 is li) will result in false.

AnkurKumarShukla commented 6 months ago

Make a one layer deep copy using slices

li2 = li[:] # => li2 = [1, 2, 4, 3] but (li2 is li) will result in false.

in this line it say it create deep copy . but its found that it create shallow copy

jklebes commented 1 week ago

Well spotted, that is not a deep copy.

I think it's simply an error of unclear writing. The original comment author meant "a one-layer-deep copy" , i.e a shallow copy, while @AnkurKumarShukla and many others read "a one-layer deep-copy", i.e. a type of deep copy.

I will fix and PR.

BTW I checked if the confusion has propagated to other languages.

French has it right, the line doesn't exist in German, Spanish, Turkish Italian quotes the ambiguous English Vietnamese quotes the wrong English Interpretation. pt-br probably translated the wrong interpretation I don't know about arabic, czech, russian, japanese, Chinese

Help needed: Someone to correct

Someone to check. Arabic, Czech, Russian, Japanese, Chinese