[IPython-dev] Curly braces stripped from magic input

Matt Davis jiffyclub@gmail....
Sat Aug 31 12:07:41 CDT 2013


Is there any way around this, or do we just have to tell our students to
use \d{{3,4}} instead of valid regex?

Thanks,
Matt


On Sat, Aug 31, 2013 at 10:03 AM, Thomas Kluyver <takowl@gmail.com> wrote:

> Yes, we run a derivative of format which allows you to embed Python
> variables in magic or system calls like this:
>
> myvar='foo'
> %magic {myvar}
>
>
> On 31 August 2013 09:36, Matt Davis <jiffyclub@gmail.com> wrote:
>
>> Hi all,
>>
>> Software Carpentry is working on a magic for the Notebook for learning
>> regex. It'll take a pattern and some strings and highlight matches. We've
>> run into a problem because curly braces seem to be stripped from magic
>> input before it gets to the function. See an example at
>> http://nbviewer.ipython.org/6399267.
>>
>> It looks like the input is being sent through .format or some Jinja
>> formatting because sending in {{ }} results in { }.
>>
>> Advice appreciated.
>>
>> Thanks,
>> Matt & Greg
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20130831/7ca31804/attachment.html 


More information about the IPython-dev mailing list