How can I know the name of "caller"
gnewsg at gmail.com
Wed Jun 20 21:49:27 CEST 2007
On 20 Giu, 06:52, John Nagle <n... at animats.com> wrote:
> billiejoex wrote:
> > Hi there,
> > unfortunately, I'm compelled to apply a sort of monkey patching at the
> > code of an existing libreary that I can't modify directly.
> > ...(if it is possible) how can I get, from method "called", the name
> > of function/method that called it (in this case "caller")?
> Bad idea.
> Note, though, that within Python, you can easily replace existing
> function definitions with your own. This is something of a desperation
> measure, but it works.
> I have a small collection of patches to the standard Python libraries
> which I import. (I've reported all of them in the tracker as bugs, and some
> later version of Python will contain the fixes. But that can take years.)
> John Nagle
Yeah, it seems really horrible to me too. Python is awesome but
stdlib, imo, lacks of properly maintenance.
I sincerely don't know what to do...
In a production environment what could be better? Overriding the
bugged method or including the patched version of the entire module
into the distribution?
More information about the Python-list