On Jul 18, 1:32 am, John Machin <[EMAIL PROTECTED]> wrote:
> On Jul 18, 4:26 pm, castironpi <[EMAIL PROTECTED]> wrote:
>
> > I delicately ask for an example in natural language and daily life in
> > which we change what object a name refers to,
>
> her, him, it, ... i.e. any pronoun
In that case,
On 17 juil, 15:56, mk <[EMAIL PROTECTED]> wrote:
> Calvin Spealman wrote:
> > To your actual problem... Why do you wanna do this anyway? If you want
> > to change the function in the dictionary, why don't you simply define
> > the functions you'll want to use, and change the one you have bound to
>
On Jul 18, 4:26 pm, castironpi <[EMAIL PROTECTED]> wrote:
> I delicately ask for an example in natural language and daily life in
> which we change what object a name refers to,
her, him, it, ... i.e. any pronoun
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 17, 7:36 pm, bgeddy <[EMAIL PROTECTED]> wrote:
> bgeddy wrote:
> > castironpi wrote:
> >> On Jul 17, 10:05 am, mk <[EMAIL PROTECTED]> wrote:
> def f2(arg):
> return "f2 "+arg
> def f1(arg):
> return "f1 "+arg
> a={"1":"f1","2":"f2"}
> print [eval(x[1])(x
On Jul 18, 10:36 am, bgeddy <[EMAIL PROTECTED]> wrote:
[snip]
> the OP's post revolved around having a rewritable
> set of "labels" - which could be recorded at one time and when re
> referenced the new definitions of those labels would be used. For
> example a "collection" (list,dictionary,tuple)
bgeddy wrote:
castironpi wrote:
On Jul 17, 10:05 am, mk <[EMAIL PROTECTED]> wrote:
def f2(arg):
return "f2 "+arg
def f1(arg):
return "f1 "+arg
a={"1":"f1","2":"f2"}
print [eval(x[1])(x[0]) for x in a.items()]
def f2(arg):
return "New f2 "+arg
print [eval(x[1])(x[0]) for x in a.items
castironpi wrote:
On Jul 17, 10:05 am, mk <[EMAIL PROTECTED]> wrote:
def f2(arg):
return "f2 "+arg
def f1(arg):
return "f1 "+arg
a={"1":"f1","2":"f2"}
print [eval(x[1])(x[0]) for x in a.items()]
def f2(arg):
return "New f2 "+arg
print [eval(x[1])(x[0]) for x in a.items()]
Neat trick
On Jul 17, 10:05 am, mk <[EMAIL PROTECTED]> wrote:
> > def f2(arg):
> > return "f2 "+arg
>
> > def f1(arg):
> > return "f1 "+arg
>
> > a={"1":"f1","2":"f2"}
> > print [eval(x[1])(x[0]) for x in a.items()]
> > def f2(arg):
> > return "New f2 "+arg
> > print [eval(x[1])(x[0]) for x in a.i
def f2(arg):
return "f2 "+arg
def f1(arg):
return "f1 "+arg
a={"1":"f1","2":"f2"}
print [eval(x[1])(x[0]) for x in a.items()]
def f2(arg):
return "New f2 "+arg
print [eval(x[1])(x[0]) for x in a.items()]
Neat trick, if probably dangerous in some circumstances. Anyway, thanks,
I
Uwe Schmitt wrote:
Python stores references in dictionaries and does not copy ! (unless
you explicitly use the copy module) !
In your case the entry in the dictionary is a reference to the same
object which f1 references, that is the object at 0xb7f0ba04.
If you now say "f1=...:" then f1 refere
mk wrote:
Calvin Spealman wrote:
To your actual problem... Why do you wanna do this anyway? If you want
to change the function in the dictionary, why don't you simply define
the functions you'll want to use, and change the one you have bound to
the key in the dictionary when you want to change i
Calvin Spealman wrote:
To your actual problem... Why do you wanna do this anyway? If you want
to change the function in the dictionary, why don't you simply define
the functions you'll want to use, and change the one you have bound to
the key in the dictionary when you want to change it? In other
On Thu, Jul 17, 2008 at 7:45 AM, mk <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I'm storing functions in a dictionary (this is basically for cooking up my
> own fancy schmancy callback scheme, mainly for learning purpose):
>
def f2(arg):
> ... return "f2 " + arg
> ...
def f1
On Jul 17, 9:45 pm, mk <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I'm storing functions in a dictionary (this is basically for cooking up
> my own fancy schmancy callback scheme, mainly for learning purpose):
>
> >>> def f2(arg):
> ... return "f2 " + arg
> ...
> >>>
> >>> def f1(arg):
On 17 Jul., 13:45, mk <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I'm storing functions in a dictionary (this is basically for cooking up
> my own fancy schmancy callback scheme, mainly for learning purpose):
>
> >>> def f2(arg):
> ... return "f2 " + arg
> ...
> >>>
> >>> def f1(arg):
>
15 matches
Mail list logo