PEP Proposal

J Peyret jpeyret at gmail.com
Thu Sep 25 16:30:56 EDT 2008


On Sep 25, 12:24 pm, python-... at arcor.de wrote:

> def whoisthethief("List" x):
>   return iknowit(x)
>
> def whoisthethief("String" x, "String" y):
>   return iknowit([x,y])
>

I dunno if this is very Pythonic in nature, but I've done things like
rebinding methods dynamically.

ex:

>>> def test(a):
... 	return a * 2
...
>>> print test(2)
4
>>> def test2(b):
... 	return b * 3
...
>>> test = test2
>>> print test(2)
6

In your case

def myNewThiefIdentifier(x,y):
   return "Dunno"

whoisthethief = myNewThiefIdentifier


Which method would this affect (i.e. which 'whoisthethief')?

I assume you could figure it out, given a match on the signature, but
how much work would this require from the developer and the
interpreter?

(apologies in case Google Groups decide to multipost)



More information about the Python-list mailing list