How to get the package, file, and line of a method/function invocant?

metaperl metaperl at gmail.com
Tue Sep 12 15:36:20 CEST 2006


Marc 'BlackJack' Rintsch wrote:
> In <1158038477.221439.15260 at e63g2000cwd.googlegroups.com>, metaperl wrote:
>
> > # Of course I could cheat and pass it, but I don't want to:
> >
> > directories = data.storage.logic(__file__)
>
> Why do you consider a plain and simple solution cheating?
>

Ok now I figured it out. The reason is that this function will be used
by many "client" classes. If we use the plain and simple solution, our
codebase increases in size, because each client class will supply the
function. Not only that, but they might make an error in what they
send.

By having the "server" class do the work, the code base decreases in
size and the amount of errors drops.




More information about the Python-list mailing list