[TxMt] python 'new function' command

Jacob Rus jrus at hcs.harvard.edu
Wed Oct 4 19:58:07 UTC 2006


Hi all,

I just changed the python new function command to do some fun things 
when one of python's 'special methods' is the name used for the new 
function.  So now, if you press ⇧↩ after typing a word like "setattr", 
"cmp", "repr", or "init", you'll get a function that looks like:

     def __setattr__(self, name, value):
         pass

or

     def __cmp__(self, other):
	pass

I hope that people find it useful.  The one downside to this method is 
that if you want to name a function the same way as one of these special 
methods (but without the underscores), then using ⇧↩ will not work as 
before.  So in that case use the "def" tab trigger.

Also, we may want to figure out a way to get these to execute with the ⇥ 
key instead of using ⇧↩

In general, I'm surprised that there hasn't been more progress on the 
python bundle, given how many people claim to use it.[^1]  I suppose I'm 
as guilty for this as anyone.  Anyway, us TM python users need to start 
adding useful stuff to the bundle.  It's hard to think of things, given 
that the language is pretty low on extraneous baggage, but I'm sure 
there are places where we can speed ourselves up.

-Jacob

[^1]: http://macromates.com/wiki/Polls/WhichLanguageDoYouUse




More information about the textmate mailing list