Makeing a constant ??

Matthias Barmeier barmeier at barmeier.com
Fri Mar 17 13:48:11 CET 2000


On Fri, 17 Mar 2000 11:20:35 +0100, "Dinu C. Gherman"
<gherman at darwin.in-berlin.de> wrote:

>Matthias Barmeier wrote:
>> 
>> Hi,
>> 
>> In a funtion call I have to use a constant as one of the parameters.
>> I want this constant to be created on the fly depending on some user
>> input.
>> 
>> Is it possible in Python to "make" a constant !?
>
>I guess this is too vague a description of what you need.
>Could you rephrase it or give a code example of what you
>expect to be able to do?
>
>Regards,
>
>Dinu

Hi,

ok .... 

I have a function that needs to be called like:
	func ("abcdef")

What I want todo is to replace this:
	value="abcdef"
	func (make_constant(value))

The function I want to use is the tkinter function bind with an
expression Frederik Lundh send me.

This expression looks like this:
	widget.bind(itemName, lambda e, cb=self.driveEvent: 
			cb(e,itemName))

The second itemName in this expression is my problem.
When the event is fired I always get the message that itemName is
unknown.

When I use this instead:
	widget.bind(itemName, lambda e, cb=self.driveEvent: cb(e,
			 "<<open-window-from-file>>"))
everything works fine.

For me (and I am absolute newbie to Python) it looks like TkInter
expects a constant expression. My problem is I dont want to write
the constant in the code. I want to produce the constant after reading
an config file.


I hope this more clear now, and that you have a hint for me.

Ciao
	Matze



More information about the Python-list mailing list