Re: Dynamic list name from a string

2010-12-28 Thread DevPlayer
# dynamic_named_obj.py # comp.lang.python # 2010-12 Dec-28 # Topic: Dynamic list name from a string Options # attempts to answer OP's question # DevPlayer - not a solution I'd use # TO Original Poster OP: # Start from the bottom OPTION, the one you requested. # Work your way up and see how

Dynamic list name from a string

2010-12-20 Thread MarcoS
Hi, I need to create a list with a dynamic name, something like this: '%s_list' %my_dynamic list = [] It's this possible? -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic list name from a string

2010-12-20 Thread Steven D'Aprano
On Mon, 20 Dec 2010 02:08:57 -0800, MarcoS wrote: Hi, I need to create a list with a dynamic name, something like this: '%s_list' %my_dynamic list = [] It's this possible? I'm pretty sure you don't *need* to, you just think you do. It is highly unlikely that there is anything you can do

Re: Dynamic list name from a string

2010-12-20 Thread Andre Alexander Bell
Hello, On 12/20/2010 11:08 AM, MarcoS wrote: Hi, I need to create a list with a dynamic name, something like this: '%s_list' %my_dynamic list = [] It's this possible? I would suggest you use a dictionary to store your lists like this: lists = {} lists[my_dynamic_list] = [] Maybe you

Re: Dynamic list name from a string

2010-12-20 Thread MarcoS
Ok, thanks Steven and Andre for yours reply. This is my situation: I've a list of objects of differents classes, with a common attribute name Something like this: class Object1: obj1_name other fields date class Object2: obj2_name other fields date ... class