Re: Vim capable IDE?

2005-10-17 Thread Dan Farina
Chris Lasher wrote:
> Hello,
>   Is there a Python-sensitive, Linux compatible IDE out there with
> standard bells and whistles (source browser, symbolic debugger, etc.)
> but with the action-per-keystroke editing capabilities of Vim? I have
> failed to turn up such an IDE in my Googling and IDE project-page
> browsing. :-(
> 
> Thanks very much in advance,
> Chris
> 

If you don't have religious feelings on Java (or are able to ignore them 
for the time being) you could try Eclipse and pydev (see 
pydev.sourceforge.net)

I use it.  I think it works well.

df
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Hygenic Macros

2005-10-18 Thread Dan Farina
David Pokorny wrote:
> Hi,
> 
> Just wondering if anyone has considered macros for Python. I have one 
> good use case. In "R", the statistical programming language, you can 
> multiply matrices with A %*% B (A*B corresponds to pointwise 
> multiplication). In Python, I have to type
> 
> import Numeric
> matrixmultiply(A,B)
> 
> which makes my code almost unreadable.
> 
> Thanks,
> David

The problem here is that Python's parse trees are of non-trivial ugliness.

A page on the compiler.ast module:
http://docs.python.org/lib/node792.html

it is, in fact, perfectly possible to write yourself a pre-processor for 
your particular application.  You may have to fiddle with the token you 
want for notation depending on how the AST fleshes out (% is used by at 
least a couple of things, after all).  My cursory familiarity with 
python grammar suggests to me that this particular choice of token could 
be a problem.

I would say try it and see.  Keep in mind though that since Python's AST 
is not a trivial matter like it is in Lisp and the like that doing 
metaprogramming of this sort probably falls into the category of black 
magic unless it turns out to be very trivial.

Another option is to define your own tiny class that will override the 
__mult__ method so that you can simply do:

A * B

Which may not be what you want.

df
-- 
http://mail.python.org/mailman/listinfo/python-list