These are chat archives for evhub/coconut

19th
Oct 2016
Mikael Davidsson
@kaptendavidsson_twitter
Oct 19 2016 09:17

I had some problem running map in Jupyter notebook. Seems like map is set to _coconut_map as part of the initialization. This leads to

new_map = _coconut.map.__new__(cls, function, *iterables) on line 207 in header.py

calling itself, resulting in a “maximum recursion depth exceeded”-error to second time map is run. It can be fixed by changing to code to

import builtins
new_map = builtins.map.__new__(cls, function, *iterables)

Is this fix acceptable?

Constantine Molchanov
@moigagoo
Oct 19 2016 09:37

Hi guys! Quick and possibly silly question, but I haven't found a related issue. When I run Coconut in Jupyter, I get this message:

c:\users\moigagoo\appdata\local\scoop\apps\python\3.5.2\lib\site-packages\jupyter_console\ptshell.py:94: UserWarning: No lexer found for language 'coconut'. Treating as plain text.
  warn("No lexer found for language %r. Treating as plain text." % name)
Jupyter console 5.0.0

Coconut 1.2.0-post_dev15 [Colonel]

Is that the expected behavior?

Evan Hubinger
@evhub
Oct 19 2016 19:42
@moigagoo I submitted jupyter/jupyter_console#102 to Jupyter to fix that issue, and it was merged, but it hasn't been released yet. Once it's released coconut --jupyter console will support the same syntax highlighting as Coconut's own console, and that message will go away. The issue is tracked in #176.
Evan Hubinger
@evhub
Oct 19 2016 20:21
@kaptendavidsson_twitter You are correct that Coconut redefines the built-in map function, however _coconut.map is not the same as _coconut_map--the first is the old map, the second one is the new map. Thus, Coconut shouldn't be introducing any recursion there. If you're experiencing such an error, my best guess as to how that could happen is that somehow the header is being run twice, since that would cause Coconut to store its own _coconut_map inside of _coconut.map. I'm not sure how you could have run the header twice, though. Can you give me some more information on how exactly you ran Coconut that caused that error to occur?