Why doesn't Python remember the initial directory?
Jean-Michel Pichavant
jeanmichel at sequans.com
Mon Aug 20 10:39:47 EDT 2012
kj wrote:
> 99.99% of Python programmers
> will find that there's nothing wrong with behavior
[snip]
> Pardon my cynicism, but the general vibe from the replies I've
> gotten to my post (i.e. "if Python ain't got it, it means you don't
> need it")
>
[snip]
Don't you find there's something wrong in applying your observation from
2 or 3 replies to your post to 99% of python programmer ? Moreover,
flaming people on their own mailing list won't do you any good, ever, in
any list.
To get back to your original question,
> inspect.getmodule?
Docstring:
Return the module an object was defined in, or None if not found.
As getmodule may return None if not found, you need too handle that
case. There's possibly a weakness in the inspect module when changing
the current directory however nothing wrong with Python having the
remember the intial directory. If you need to remember it, do it youself
(or file a bug to inspect module authors).
JM
More information about the Python-list
mailing list