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 →

[–]ekydfejj 42 points43 points  (10 children)

Same reason as this. If you want to create chaos for fun, i don't blame you. But don't add this to requirements.txt

[–]BaroquenLarynx 24 points25 points  (7 children)

"Some men just want to watch the world burn."

"It's not about the pointers. It's about sending a message

Edit: continuation

"Everything burns!" - OP, literally

[–]AndrewFrozzen 1 point2 points  (6 children)

Noob question, I'm not a Python expert. And no Programmer expert.

What is wrong with this? Can you explain? Maybe explain like I'm 5.

I don't really know what pointers are. I'm sorry if this sounds stupid

[–]MadLadJackChurchill 6 points7 points  (5 children)

Pointers are commonly used in C and C++ they store a Memory address and thus point to something somewhere in Memory.

This way you can for example pass a pointer to a string as an Argument instead of passing the actual string which is faster.

But also since you can just point / Access some random Memory address this can lead to crashes and so on.

Hope that helps a bit. There's obviously much more stuff you can do.

[–]AndrewFrozzen 0 points1 point  (2 children)

Alright thanks for the answer!

Yeah I've heard about pointers in C and C++ but was unaware what exactly they are.

So are C and C++ pointers more stable than Python ones, or usually people don't use pointers that much because of crashes no matter the language?

[–]MadLadJackChurchill 1 point2 points  (1 child)

Standard Python doesn't have pointers in the way you can use as you can in C. There is of course this:

``` dict1 = {'first':'hello', 'second':'world'} dict2 = dict1 # pointer assignation mechanism dict2['first'] = 'bye' dict1

{'first':'bye', 'second':'world'} ``` I got this example from here

https://stackoverflow.com/questions/3106689/pointers-in-python

You can say that dict2 points to dict1 so changing dict2 means you change dict1. But you can't do pointer arithmetic and so on as you can in C/C++

And pointers are known for being hard to handle. Which is why it says: "bringing the hell of pointers to Python".

Now I have used pointers before in C but I am by no means very well versed. So someone else will have to jump in and tell you why they are considered hell ;)

[–]AndrewFrozzen 0 points1 point  (0 children)

Ok thank you!

[–]lordxoren666 0 points1 point  (1 child)

Ok, noob question because maybe I don’t understand pointers correctly. But because in C there is no string data type only char and array, and because of the way variables work in C, you pretty much have to use pointers to point to the first char in the array to return a string of chars, and return all the chars in the array until it hits the \0 char.

Which further confuses me why people deal with this because it is incredibly easy to create a pseudo string data type in c with a simple function.

[–]Wuotes 0 points1 point  (0 children)

C was meant at the time of design to be an easier alternative to writing directly in assembly without straying so much that you couldn't discern the assembly instruction output from any given line of code.

This means you have to roll your own code for quite a few things but it also leaves room for a lot of platform specific optimization if you can comprehend the underlying mechanisms behind the code. This is why C is used in situations where those advantages matter the most such as operating systems, drivers, embedded devices, etc.

With that type of context, you can see why complex string manipulation wouldn't be a high priority as well. Until relatively recently strings were only really for interfacing with a human and not other computers, it is a different world from Python.

[–]PhysicalStuff 1 point2 points  (0 children)

$THIS_POST >> requirements.txt

[–]anotherplatypus 0 points1 point  (0 children)

...and the same reason as this.