[TxMt] Python bundle syntax highlighting bug

Alex Ross alex.j.ross at gmail.com
Sun Aug 12 04:34:04 UTC 2007


Hmm,

We have the grammar set to treat "raw" strings as a regular  
expression.  They were introduced to the python language specifically  
to make writing regular expressions easier, so this seems logical.

Anyway, the grammar thinks that you're LaTeX code is a regular  
expression.  My suggestion would be to remove the "r" from before  
your doc-string.  Is there a particular reason you are using them?

–Alex


On Aug 11, 2007, at 9:04 PM, Anand Patil wrote:

> def half_normal_like(x, tau):
>     r"""
>     half_normal_like(x, tau)
>
>     Half-normal log-likelihood, a normal distribution with mean 0  
> and limited
>     to the domain :math:`x \in [0, \Infty)`.
>
>     .. math::
>         f(x \mid \tau) = \sqrt{\frac{2\tau}{\pi}}\exp
> \left\{ {\frac{-x^2 \tau}{2}}\right\}
>
>     :Parameters:
>       x : float
>         :math:`x \ge 0`
>       tau : float
>         :math:`\tau > 0`
>
>     """
>     # try:
>     #     constrain(tau, lower=0)
>     #     constrain(x, lower=0, allow_equal=True)
>     # except ZeroProbability:
>     #     return -Inf
>     return flib.hnormal(x, tau)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070811/ec5aeb3b/attachment.html>


More information about the textmate mailing list