0
how can i create a variable within a variable?
i want to create a program with a variable that can store other variables and their data types, is it possible?
4 odpowiedzi
+ 8
it is possible
but it'd be easier to do a list
+ 4
Call it class, instance and.or object, and you hold a new programmation paradigm :P
+ 2
Look into Classes
class cars:
def __init__(self, model, year):
self.model = model
self.year = year
mycar = cars(dodge, 1978)
+ 1
That's actually impossible: a variable is a representation of a "thing" in memory.
Creating a variable in a variable would mean creating a representation of a representation of a "thing" in memory.
Once you allow that, why not infinite variable recursion?