importing with .m instead of .py

Wanderer wanderer at dialup4less.com
Fri Sep 25 21:55:27 CEST 2009


On Sep 25, 2:05 pm, Andrew Svetlov <andrew.svet... at gmail.com> wrote:
> On Sep 25, 1:16 pm, Wanderer <wande... at dialup4less.com> wrote:
>
> > execfile(x) does what I'm looking for.
>
> Perhaps you are looking for Python import hook:http://www.python.org/dev/peps/pep-0302/
>
> In you import hook you can do everything (and locate/import file with
> any extension :)

I'm just porting a bunch of octave functions into pylab that use data
I collected in files like I show above. The execfile() method lets me
verify I get the same results in Octave and Python. It is in the NumPy
for Matlab users page at Mathesaurus http://mathesaurus.sourceforge.net/matlab-numpy.html,
but they make it look like it needs a .py extension. Like Ishwor said
'Trivial', now that I know how :)



More information about the Python-list mailing list