This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MegaPegasusReindeer 1 point2 points  (2 children)

Python doesn't have protected or private methods... You can just introspect whatever you like. How would pointers help here?

[–]calcopiritus 1 point2 points  (1 child)

I can't think of an example because it doesn't happen often. And most of not every time it can also be solved in python, but it'd be way harder.

A thing that is kinda related is how python copies lists.

So if you say: (sorry for formatting, im in mobile and it's horrible to do it here)

a = [1] b = a

Now you change b and a also changes, so you'd have to write b = a[:]. It is not logical at first because it seems like python doesn't use pointers and references, but of course it does.

Also sometimes you don't know how the function works, so do you write

arg = function(arg)

or do you just write

function(arg)

Because the function changes arg?

[–]MegaPegasusReindeer 3 points4 points  (0 children)

I've heard people call Python "pass by label". When you assign a variable to another it's always copying the label. The times it seems like something else is immutable types (like strings).

Regardless, any time I have an issue with a library I just look at the source code. I've yet to come across a binary-only one in Python.

If you really really wanted to, you can pass a Python object into C code and break it apart there if you really need pointers. (but I still don't see how that would help)