Re: PyReloc - BinReloc for python
"Thomas Leonard" <[email protected]>
| Newsgroups | gmane.comp.autopackage.devel |
|---|---|
| Message-ID | <[email protected]> |
On 8/18/07, Isak Savo <[email protected]> wrote: > 2007/8/17, Jan Niklas Hasse <[email protected]>: > > > 1) Is the __file__ variable always a full path? For all python > > > versions/implementations? > > > - If not, it should be documented which versions are supported. > > I'm sorry, i don't know and i couldn't find anything about it in the docs. > > Let's assume that it is then. If you could write a small test program, > we could then test it on various machines. I have Python 2.4.4 and > 2.5.1 on my system. It's been there forever. Here's an example for Python 2.2: http://www.ibm.com/developerworks/linux/library/l-pyint.html > > > 2) Is this how a python API is typically done? With variables instead > > > of functions? > > I also don't know. I thought as there isn't much to do, a variable is > > easier to use. > > Fair enough. I'm a c/c++/c# guy and thus my eyes and brain are > instantly alerting when I see global variables. :-) > If possible, I think they should at least be namespaced, so you do > BinReloc.SelfPath, BinReloc.BinDir or similar when accessing them. Is > that doable? They're not global in the C sense; they're per-module. E.g. you'd use them as: import reloc reloc.BINDIR > If anyone else on this list knows python coding standards, please feel > free to speak up now. Using __file__ is very common in Python programs. I don't know about these BINDIR variables, though. People just seem to use it directly. e.g. in django (first project I tried grepping through): basedir = os.path.split(module.__file__)[0] -- Dr Thomas Leonard http://rox.sourceforge.net GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 --------------------------------------------------------------------- To unsubscribe, e-mail: autopackage-dev-unsubscribe-OfajU3CKLf1/[email protected] For additional commands, e-mail: autopackage-dev-help-OfajU3CKLf1/[email protected]