Re: Enumeration of strings and export of the constants

2010-11-11 Thread lnenov
On 11/10/2010 11:19 PM, Emile van Sebille wrote: On 11/10/2010 5:12 AM lnenov said... Hi, I need to enumerate a couple hundred strings to constants and export them to another module(s) globals. Do they really need to be globals? Why not a constants in an object/container that would neither

Re: Enumeration of strings and export of the constants

2010-11-11 Thread lnenov
On 11/11/2010 01:30 AM, Ian wrote: On Nov 10, 6:12 am, lnenov wrote: Is there a better and more common way to do this? from itertools import count, izip class APINamespace(object): def __init__(self): self._named_values = [] def enumerate(self, names, start=0, step=1):

Re: Enumeration of strings and export of the constants

2010-11-10 Thread Ian
On Nov 10, 6:12 am, lnenov wrote: > Is there a better and more common way to do this? from itertools import count, izip class APINamespace(object): def __init__(self): self._named_values = [] def enumerate(self, names, start=0, step=1): self._named_values.extend(izip(na

Re: Enumeration of strings and export of the constants

2010-11-10 Thread Emile van Sebille
On 11/10/2010 5:12 AM lnenov said... Hi, I need to enumerate a couple hundred strings to constants and export them to another module(s) globals. Do they really need to be globals? Why not a constants in an object/container that would neither pollute the global namespace nor risk being shado