Roy Smith wrote:
The idea is I want to put in the beginning of the module:
declare('XYZ_FOO', 0, The foo property)
declare('XYZ_BAR', 1, The bar property)
declare('XYZ_BAZ', 2, reserved for future use)
Okay, that seems like a passable excuse.
One thing to watch out for is that if your
Roy Smith wrote:
From inside a module, I want to add a key-value pair to the module's
__dict__. I know I can just do:
FOO = 'bar'
at the module top-level, but I've got 'FOO' as a string and what I
really need to do is
__dict__['Foo'] = 'bar'
When I do that, I get NameError: name '__dict__'
In article mailman.96.1267508316.23598.python-l...@python.org,
Chris Rebert c...@rebertia.com wrote:
On Mon, Mar 1, 2010 at 8:27 PM, Roy Smith r...@panix.com wrote:
From inside a module, I want to add a key-value pair to the module's
__dict__. Â I know I can just do:
FOO = 'bar'
at
Roy Smith wrote:
In article mailman.96.1267508316.23598.python-l...@python.org,
Chris Rebert c...@rebertia.com wrote:
On Mon, Mar 1, 2010 at 8:27 PM, Roy Smith r...@panix.com wrote:
From inside a module, I want to add a key-value pair to the module's
__dict__. Â I know I can just do:
FOO
Roy Smith wrote:
[ ... ]
Why is it unwise?
The use case is I'm importing a bunch of #define constants from a C header
file. I've got triples that I want to associate; the constant name, the
value, and a string describing it. The idea is I want to put in the
beginning of the module:
On Mar 2, 8:33 am, Steve Holden st...@holdenweb.com wrote:
And how important is it to make sure that whatever data your program
processes doesn't overwrite the actual variable names you want to use to
program the processing?
Oh, I see what you're saying. You're thinking I was going to
Roy Smith wrote:
On Mar 2, 8:33 am, Steve Holden st...@holdenweb.com wrote:
And how important is it to make sure that whatever data your program
processes doesn't overwrite the actual variable names you want to use to
program the processing?
Oh, I see what you're saying. You're thinking
On 3/2/2010 10:19 AM, Roy Smith wrote:
Somewhat sadly, in my case, I can't even machine process the header
file. I don't, strictly speaking, have a header file. What I have is
a PDF which documents what's in the header file, and I'm manually re-
typing the data out of that. Sigh.
Here's an
On Mar 2, 5:21 am, Roy Smith r...@panix.com wrote:
In article mailman.96.1267508316.23598.python-l...@python.org,
Chris Rebert c...@rebertia.com wrote:
On Mon, Mar 1, 2010 at 8:27 PM, Roy Smith r...@panix.com wrote:
From inside a module, I want to add a key-value pair to the module's
John Posner wrote:
On 3/2/2010 10:19 AM, Roy Smith wrote:
Somewhat sadly, in my case, I can't even machine process the header
file. I don't, strictly speaking, have a header file. What I have is
a PDF which documents what's in the header file, and I'm manually re-
typing the data out of
On 3/2/2010 11:18 AM, John Posner wrote:
On 3/2/2010 10:19 AM, Roy Smith wrote:
Somewhat sadly, in my case, I can't even machine process the header
file. I don't, strictly speaking, have a header file. What I have is
a PDF which documents what's in the header file, and I'm manually re-
typing
Terry Reedy wrote:
On 3/2/2010 11:18 AM, John Posner wrote:
On 3/2/2010 10:19 AM, Roy Smith wrote:
Somewhat sadly, in my case, I can't even machine process the header
file. I don't, strictly speaking, have a header file. What I have is
a PDF which documents what's in the header file, and I'm
From inside a module, I want to add a key-value pair to the module's
__dict__. I know I can just do:
FOO = 'bar'
at the module top-level, but I've got 'FOO' as a string and what I
really need to do is
__dict__['Foo'] = 'bar'
When I do that, I get NameError: name '__dict__' is not defined. Is
On Mon, Mar 1, 2010 at 8:27 PM, Roy Smith r...@panix.com wrote:
From inside a module, I want to add a key-value pair to the module's
__dict__. I know I can just do:
FOO = 'bar'
at the module top-level, but I've got 'FOO' as a string and what I
really need to do is
__dict__['Foo'] = 'bar'
14 matches
Mail list logo