<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Venkat Aditya kandrekula on Medium]]></title>
        <description><![CDATA[Stories by Venkat Aditya kandrekula on Medium]]></description>
        <link>https://medium.com/@venkataditya005?source=rss-f57a1f3e203a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tNrGQuNAkxFEumC6AUU3QQ.jpeg</url>
            <title>Stories by Venkat Aditya kandrekula on Medium</title>
            <link>https://medium.com/@venkataditya005?source=rss-f57a1f3e203a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 20:07:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@venkataditya005/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Assignment vs Shallow Copy vs Deep Copy in Python: Understanding the Difference with Simple…]]></title>
            <link>https://medium.com/@venkataditya005/assignment-vs-shallow-copy-vs-deep-copy-in-python-understanding-the-difference-with-simple-16e2ba46fac5?source=rss-f57a1f3e203a------2</link>
            <guid isPermaLink="false">https://medium.com/p/16e2ba46fac5</guid>
            <category><![CDATA[deep-copy]]></category>
            <category><![CDATA[deep-copy-vs-shallow-copy]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[shallow-copy]]></category>
            <category><![CDATA[assignment]]></category>
            <dc:creator><![CDATA[Venkat Aditya kandrekula]]></dc:creator>
            <pubDate>Tue, 03 Nov 2026 14:59:34 GMT</pubDate>
            <atom:updated>2026-11-03T14:59:34.196Z</atom:updated>
            <content:encoded><![CDATA[<h3>Assignment vs Shallow Copy vs Deep Copy in Python: Understanding the Difference with Simple Examples</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vfo6ODXgKVfN79ijKx_XNQ.png" /></figure><p>Have you ever made a copy of a list in python, and then made a change to one value and noticed the changes in the original list?</p><p>This can be confusing to begin with. However,</p><p>Python has a few options for handling objects;</p><p>Assignment</p><p>Shallow Copy</p><p>Deep Copy</p><p>They may appear similar but have very different functions, especially when dealing with nested lists.</p><p>Let’s learn more about each below.</p><h4>1. Assignment → You aren’t actually copying</h4><p>The simplest option.</p><p>When assigning in Python we are creating another variable which points to the same object.</p><p>Let’s take a look at an example.</p><p>original = [10, 20, 30]</p><p>copied = original</p><p>copied[0] = 100</p><p>print(original)</p><p>print(copied)</p><p>Output:</p><p>[100, 20, 30]</p><p>[100, 20, 30]</p><p>Why did the original list change?</p><p>Because you’re creating a new variable to point to the same list in memory.</p><p>We didn’t create a new list. We just created a new variable name.</p><p>Imagine you have a key to your house and your friend has the same key. Both of you go into the same house. Your friend moves the furniture around. When you go into the house it will look exactly the same.</p><p>This is what assignment does.</p><p>Remember: Assignment does not create a new object. It creates another reference to the existing object.</p><h4>2. Shallow Copy — New outer object but shares inner objects</h4><p>Let’s talk about shallow copies now.</p><p>Shallow copies are different to assignments as they do create a new outer object.</p><p>However, if there are objects within the original object they will still be shared.</p><p>Let’s take a look.</p><p>import copy</p><p>original = [[10, 20], [30, 40]]</p><p>copied = copy.copy(original)</p><p>copied[0][0] = 100</p><p>print(original)</p><p>print(copied)</p><p>Output:</p><p>[[100, 20], [30, 40]]</p><p>[[100, 20], [30, 40]]</p><p>Why did the original list change?</p><p>Because we aren’t creating a new list for the inner list. We are just creating a new outer list.</p><p>Let’s look at another example.</p><p>import copy</p><p>original = [[10, 20], [30, 40]]</p><p>copied = copy.copy(original)</p><p>copied.append([50, 60])</p><p>print(original)</p><p>print(copied)</p><p>Output:</p><p>[[10, 20], [30, 40]]</p><p>[[10, 20], [30, 40], [50, 60]]</p><p>Notice how this time the original list hasn’t changed.</p><p>Because we are adding a new item to the copied outer list. We aren’t affecting any shared inner lists.</p><p>Remember: Shallow copies create a new outer object but share references to any nested objects.</p><h4>3. Deep Copy — Fully independent copy</h4><p>Now let’s talk about deep copies.</p><p>Deep copies create a new object and then recursively copies any objects within.</p><p>This means that any changes to the copied object will not affect the original object. Even if there are nested lists.</p><p>Example:</p><p>import copy</p><p>original = [[10, 20], [30, 40]]</p><p>copied = copy.deepcopy(original)</p><p>copied[0][0] = 100</p><p>print(original)</p><p>print(copied)</p><p>Output:</p><p>[[10, 20], [30, 40]]</p><p>[[100, 20], [30, 40]]</p><p>Notice how the original list hasn’t changed.</p><p>This is because the nested objects are copied independently.</p><p>Imagine you photocopy an entire book with all of its pages. You can make changes to your copy without affecting the original.</p><p>Remember: Deep copies recursively copy the object and any nested objects so they are independent (in most cases of mutable containers).</p><h4>4. Comparison</h4><p>To help you remember here’s a quick comparison table.</p><p>Feature Assignment, Shallow Copy, Deep Copy</p><p>New outer object? No, Yes, Yes.</p><p>Copies nested objects? No, No, Yes.</p><p>Shared nested objects? Yes, Yes, Generally no.</p><p>Changes to shared nested objects affect original? Yes, Yes, No.</p><h4>5. How to create these copies in Python?</h4><p>Here are the three ways.</p><p>Assignment</p><p>copied = original</p><p>Shallow Copy</p><p>import copy</p><p>copied = copy.copy(original)</p><p>Deep Copy</p><p>import copy</p><p>copied = copy.deepcopy(original)</p><p>Shallow copies can be created with slicing.</p><p>copied = original[:]</p><p>Or with the .copy() method.</p><p>copied = original.copy()</p><h4>6. When should you use each?</h4><p>Understanding the differences between the three is important. However, knowing when to use each will be even more helpful.</p><p>Assignment → When you want to have multiple variables pointing to the same object.</p><p>Shallow Copy → When you want a new outer collection but don’t need independent nested objects.</p><p>Deep Copy → When you need an independent copy of an object and any nested mutable objects.</p><p>Something to keep in mind is that deep copies are not always needed. They can take up more memory and processing power. Especially with large/complex objects.</p><p>Deep copies also don’t guarantee that all objects in Python will be completely independent. Custom objects can define their own copy behaviours and some resources cannot be meaningfully copied.</p><h4><strong>Final Thoughts:</strong></h4><p>Assignment, shallow copy and deep copy can appear like simple ways to copy data. However knowing how they work can help avoid some confusing bugs.</p><p>The easiest way to remember is:</p><p>Assignment → Same object, new variable.</p><p>Shallow Copy → New outer object, shared inner objects.</p><p>Deep Copy → New outer object and recursively copied inner objects.</p><p>Next time when we are working with lists, dictionaries or nested objects in Python remember to double check that we have actually created a copy.</p><p>Just because we have another variable in Python doesn’t mean we have another object.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16e2ba46fac5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding how RBAC works, Sets, and Dictionary]]></title>
            <link>https://medium.com/@venkataditya005/understanding-how-rbac-works-sets-and-dictionary-3281ff94921f?source=rss-f57a1f3e203a------2</link>
            <guid isPermaLink="false">https://medium.com/p/3281ff94921f</guid>
            <category><![CDATA[rbac]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[dictionary]]></category>
            <category><![CDATA[set]]></category>
            <dc:creator><![CDATA[Venkat Aditya kandrekula]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 04:03:21 GMT</pubDate>
            <atom:updated>2026-10-13T04:03:21.271Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>RBAC:</strong></h3><p>Did you ever think of how the school management gives marks through online result but no student can edit their marks?</p><p>Because the management follows the RBAC, which stands for Role Based Access Control. RBAC is a method of managing permissions among the management based on their role. it is used in software companies, schools, colleges, etc.</p><p>RBAC helps stop the breach of sensitive information, access to all important information, and assign the permissions to their related role.</p><p>Role-Based Access Control, or RBAC, is a security approach in which users receive permissions through their assigned roles.</p><p>instead of assigning permissions to every single person, RBAC categorizes every individual into roles and gives permissions.</p><p>let’s take school management as example:</p><p>Admin: A role in the system who can create, edit, update, view and delete records.</p><p>Teacher: a role in the system who can view and update records.</p><p>Student: A role in the system who can view the records.</p><p>by following the RBAC in school management system,</p><p><strong>Admin </strong>can upload the results of the exam, update if any mistakes, view the results of all student, and delete results.</p><p><strong>Teacher </strong>can view the results of students, and update the marks.</p><p><strong>Student </strong>can only view their own marks.</p><p>following the RBAC, helps in students changing their own results which are in favor to them. RBAC helps the system enforce these restrictions.</p><h3>Why is RBAC important?</h3><p>RBAC offers several advantages:</p><p><strong>Simpler management:</strong> Permissions can be managed centrally through roles.</p><p><strong>Better security:</strong> Users receive only the access they need.</p><p><strong>Consistency:</strong> Users with the same role can share the same permissions.</p><p><strong>Easy maintenance:</strong> When a role’s permissions change, the system can update that role rather than every user individually.</p><p>In a real application, RBAC requires proper authentication, permission checks, and enforcement by the application or server. Simply defining roles in Python does not automatically secure a system.</p><h3><strong>UNDERSTANDING HOW PYTHON SET AND DICTIONARY WORK</strong></h3><p><strong>Set: </strong>A set is a Python data structure that stores unique elements. Duplicate values are automatically removed.</p><p>we can create a set using “{}” and “set()” function.</p><p>example:</p><p>x= set([1,2,3,4]) and y={1,2,3,4}</p><p>when we print(x) we get {1,2,3,4} because set removes all duplicates and store onyly unique values.</p><p><strong>Important chracteristics of the set:</strong></p><ol><li>set contains unique values:</li></ol><p>let’s assume a set a={“admin”,”teacher”,”admin”}</p><p>when we, print(a)</p><p>we get, a={‘admin’,’teacher’}</p><p>2. Sets support membership testing:</p><p>a={“admin”,”teacher”,”admin”}</p><p>print(“admin” in a)</p><p>print(“student” in a)</p><p>we get,</p><p>true</p><p>false.</p><p>3. Sets support mathematical operations:</p><p>sets can perform mathematical operations like “AnB”,”AuB”</p><p>A={“read”,”write”,”research”}</p><p>B={“read”,”write”}</p><p>print(A-B)</p><p>we get, {‘research’}</p><h3><strong>understanding python dictionaries:</strong></h3><p>A dictionary stores information as key-value pairs.</p><p>Each key identifies a value associated with it.</p><p>example:</p><p>student={“name”:”venkat”</p><p>“age”:”21&quot;</p><p>“gender”:”male” }</p><p>print(student[name])</p><p>we get, venkat.</p><p>Dictionaries are useful when we need to associate one piece of information with another, such as a student’s name with their age or a username with an account’s details.</p><p>Unlike sets, dictionaries are designed to map keys to values.</p><h3>How Do Sets Help Us Understand Dictionaries?</h3><p>Let’s connect both concepts to our RBAC concept:</p><p>permissions = {</p><p>“admin”: {“read,”write”,”delete”},</p><p>“teacher”:{“read”,”write”}</p><p>“student”:{“read”}}.</p><p>Here, the dictionary stores the roles, and each role has a set of permissions. The dictionary organizes the information, while the sets store the unique permissions for each role.</p><p>For example:</p><p>print(“delete” in permissions[“student”])</p><p>we get,</p><p>false</p><p>This is because students do not have the &quot;delete&quot; permission.</p><p>Learning sets first helps us understand how to store and check collections of values. We can then see how dictionaries organize those collections under different keys.</p><h3>Conclusion</h3><p>Sets and dictionaries are different, but they work well together.</p><p>Sets help us store unique values, while dictionaries help us organize information using key-value pairs.</p><p>RBAC is a good real-world example of how both can be used together in Python. Understanding these basic concepts makes it easier to learn how Python data structures work in practical situations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3281ff94921f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>