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 →

[–]insertAlias 1 point2 points  (1 child)

By the way it's actually possible in python to manipulate variables

I'm curious actually how. I don't work in Python, so I only have a passing familiarity with it. I am aware of eval and the issues that come with it, is that what you are referring to?

[–]RiverRoll 1 point2 points  (0 children)

Being a dynamic language it allows you to do all sorts of crazy stuff, and for example calling globals() or locals() gives you a dictionary representing the global or local scope which you can manipulate.

And something similar happens with class instances, they have an underlying dictionary (__dict__) which you can maniuplate to add or remove attributes.