![]() | 1 | initial version |
How about something like this?
class VariableGenerator(object): def __init__(self, prefix): self.__prefix = prefix
@cached_method
def __getitem__(self, key):
return SR.var("%s%s"%(self.__prefix,key))
a=VariableGenerator('a')
a[0], a[1], a[2] # all variables
![]() | 2 | No.2 Revision |
How about something like this?
class VariableGenerator(object):
def __init__(self, prefix):
self.__prefix = prefixprefix
@cached_method
def __getitem__(self, key):
return SR.var("%s%s"%(self.__prefix,key))
a=VariableGenerator('a')
a[0], a[1], a[2] # all variables
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.