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

metaperl metaperl at gmail.com
Tue Sep 12 09:06:13 EDT 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?

Hmm, I dont know the proper software engineering term, but just on the
basis of instinct, it seems wrong for a function to use something that
it can get on its own.

It's kind of like being at a 5-star hotel. It might be very possible
for you to bring your own pop tarts and toast them, but they go to
great lengths to have a continental buffet ready for you without you
doing anything.

Good question, airheaded answer :)




More information about the Python-list mailing list