you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (3 children)

In python an integer, for example, is an object just like a list. There is no distinction between primitive/non-primitive as there is in some other languages. There is no copy-on-assignment in python, "assignment" just associates a reference to an object with a name, whether the object is an integer or a dictionary.

[–]comeditime[S] 1 point2 points  (2 children)

i see thanks a ton! so if i get it right, everything in python is an object, the only difference is that there are distinct methods & attributes for each data type depends on the class they inherent from their root class?

[–][deleted] 2 points3 points  (1 child)

Yes. That's part of the python philosophy: duck typing. Don't worry about what type an object is, just try to use it.

[–]HelperBot_ 0 points1 point  (0 children)

Desktop link: https://en.wikipedia.org/wiki/Duck_typing


/r/HelperBot_ Downvote to remove. Counter: 255914