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?

1st Feb 2017, 12:54 PM
Llewellyn Kay
Llewellyn Kay - avatar
4 odpowiedzi
+ 8
it is possible but it'd be easier to do a list
1st Feb 2017, 1:04 PM
Ahri Fox
Ahri Fox - avatar
+ 4
Call it class, instance and.or object, and you hold a new programmation paradigm :P
1st Feb 2017, 1:49 PM
visph
visph - avatar
+ 2
Look into Classes class cars: def __init__(self, model, year): self.model = model self.year = year mycar = cars(dodge, 1978)
1st Feb 2017, 3:16 PM
LordHill
LordHill - avatar
+ 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?
1st Feb 2017, 10:36 PM
Amaras A
Amaras A - avatar